Skip to content
Question
Q.

(a) An educational institution is maintaining a database for storing the details of courses being offered. The database includes a table COURSE with the following attributes: C_ID: Stores the unique ID for each course. C_NAME: Stores the course's name. INSTRUCTOR: Stores the name of the course instructor. DURATION: Stores the duration of the course in hours.

Table: COURSE

C_IDC_NAMEINSTRUCTORDURATION
C101Data StructuresDr. Alok40
C102Machine LearningProf. Sunita60
C103Web DevelopmentMs. Sakshi45
C104Database ManagementMr. Suresh50
C105Python ProgrammingDr. Pawan35

Write SQL queries for the following:

  1. To add a new record with following specifications: C_ID: C106 C_NAME: Introduction to AI INSTRUCTOR: Ms. Preeti DURATION: 55
  2. To display the longest duration among all courses.
  3. To count total number of courses run by the institution.
  4. To display the instructors' name in lower case. OR

(b) Ashutosh, who is a manager, has created a database to manage employee records. The database includes a table named EMPLOYEE whose attribute names are mentioned below: EID: Stores the unique ID for each employee. EMP_NAME: Stores the name of the employee. DEPT: Stores the department of the employee. SALARY: Stores the salary of the employee. JOIN_DATE: Stores the employee's joining date.

Table: EMPLOYEE

EIDEMP_NAMEDEPTSALARYJOIN_DATE
E01ARJUN SINGHSALES750002019-11-01
E02PRIYA JAINENGINEERING850002020-05-20
E03RAVI SHARMAMARKETING600002018-08-14
E04AYESHANULL500002021-01-10
E05RAHUL VERMAFINANCE400002017-06-25

Write the output of the following SQL Queries:

  1. Select SUBSTRING(EMP_NAME, 1, 5) from EMPLOYEE where DEPT = 'ENGINEERING';
  2. Select EMP_NAME from EMPLOYEE where month(JOIN_DATE) = 8;
  3. Select EMP_NAME from EMPLOYEE where SALARY > 60000;
  4. Select count(DEPT) from EMPLOYEE;
CBSECBSE Class XII Board 2025Subjective· 4mImportance★★★★★
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Part (a): INSERT C106; MAX(DURATION)=60; COUNT(*)=6 (after insert); LOWER(INSTRUCTOR) lowercases each name.

Part (b): (i) PRIYA, (ii) RAVI SHARMA, (iii) ARJUN SINGH & PRIYA JAIN, (iv) 4.

Part (a) — writing queries on COURSE

(i) Insert a record. Supply values in column order; strings quoted, the number bare.

INSERT INTO COURSE VALUES ('C106', 'Introduction to AI', 'Ms. Preeti', 55);

(ii) Longest duration. MAX returns the largest DURATION.

SELECT MAX(DURATION) FROM COURSE;
MAX(DURATION)
60

(iii) Count of courses. COUNT(*) tallies all rows. After part (i) the table holds 6 rows (5 originally).

SELECT COUNT(*) FROM COURSE;
COUNT(*)
6

(iv) Instructor names in lower case. LOWER() converts each string to lowercase.

SELECT LOWER(INSTRUCTOR) FROM COURSE;
LOWER(INSTRUCTOR)
dr. alok
prof. sunita
ms. sakshi
mr. suresh
dr. pawan …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.