CBSE Class 12 Computer Science — Structured Query Language (SQL)
All previous year questions from Chapter: Structured Query Language (SQL)
10 questions found
2026(10 questions)
- 13
Which of the following SQL command can change the degree of the existing relation ?
1 mark· A· SQL DDL - ALTER TABLE - 14
What will be the output of the query ? ```sql SELECT MACHINE_ID, MACHINE_NAME FROM INVENTORY WHERE QUANTITY <= 100; ```
1 mark· A· SQL SELECT with WHERE Clause - 16
Which aggregate function in SQL returns the smallest value from a column in a table ?
1 mark· A· SQL Aggregate Functions - 29
(a) Write an SQL command to create the above table (W_Code should be the primary key). OR (b) Can U_Price be the primary key of the above table ? Justify your answer.
1 mark· B· SQL — CREATE TABLE and Primary Key - 30
(a) Assuming that the table W_STOCK is already created, write an SQL command to add an attribute E_Date (of DATE type) to the table. OR (b) Assuming that the table W_STOCK is already created, write an SQL command to remove the column B_Qty from the table.
1 mark· B· SQL — ALTER TABLE (ADD/DROP Column) - 35
(a) Based on the data given above, write the SQL queries for the following tasks : (i) To display Type and the maximum Price for each Type of milk. (ii) For each record, increase the Price by 0.5 where Type is 'F'. (iii) To display the total value of the stock (total of Qty x Price). (iv) To display the details of all records where Code starts with 'A'. OR (b) Considering the table STOCK as given above, write the output on execution of the following queries : (i) SELECT Volume, Qty, Price FROM STOCK WHERE Type IN ('F','D'); (ii) SELECT Code, Qty FROM STOCK WHERE Price BETWEEN 30 AND 50; (iii) SELECT DISTINCT Type FROM STOCK; (iv) SELECT Volume, count(*) FROM STOCK GROUP BY Volume;
4 marks· D· SQL Queries — GROUP BY, UPDATE, Aggregate SUM, and Pattern Matching (LIKE) - 37
Number of records from LOANS table where Rate of Interest (RoI) is above 7.0.
1 mark· D· SQL COUNT() with WHERE Condition - 38
Names of the customers whose loan amount (L_Amt) is above 1000000.
1 mark· D· SQL Join between CUSTOMERS and LOANS using Common Key C_ID - 39
C_ID, C_Name and Terms of all those records where Loan Date (L_Date) is after 31st December, 2024.
1 mark· D· SQL Join with Date Comparison Condition - 40
(a) Details of all the loans in the descending order of RoI. OR (b) C_ID and average term for each C_ID from the LOANS table.
1 mark· D· SQL ORDER BY and GROUP BY with AVG()