Find Your Free Essay Examples

Important Questions Class 12 Computer Science C Structured Query Language

Free PDF download of Important Questions for CBSE Class 12 Computer Science (C++) Chapter 11 Structured Query Language prepared by expert Computer Science (C++) teachers from latest edition of CBSE(NCERT) books, On StudySolver.Org to score more marks in CBSE board examination.

Question 1: Explain the concept UNION between two tables, with the help of appropriate example.  Delhi 2014 Answer: The UNION operator is used to combine the result-set of two or more tables, without returning any duplicate rows, e.g.

Question 2: Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables. All India 2017 (i) To display all details from the table MEMBER in descending order of ISSUEDATE. (ii) To display the DCODE and DTITLE of all Folk Type DVDs from the table DVD. (iii) To display the DTYPE and number of DVDs in each DTYPE from the table DVD. (iv) To display all NAME and ISSUEDATE of those members from the table MEMBER who have DVDs issued (i.e., ISSUEDATE) in the year 2017.

  Question 3: Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables.  All India 2016  NOTE • KM is Kilometres travelled • NOP is number of passengers travelled in vehicle. (i) To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending order of CNO. (ii) To display the CNAME of all the customers from the table TRAVEL who are traveling by vehicle with code V01 or V02. (iii) To display the CNO and CNAME of those customers from the table TRAVEL who travelled between ‘2015-12-31’ and ‘2015-05-01’. (iv) To display all the details from table TRAVEL for the customers, who have travel distance more than 120 KM in ascending order of NOP.

  Question 4: Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables.  Delhi 2016   NOTE • PERKM is Freight Charges per kilometre • VTYPE is Vehicle Type  NOTE • NO is Traveller Number • KM is Kilometre travelled • NOP is number of travellers travelled in vehicle • TDATE is Travel Date (i) To display NO, NAME, TDATE from the table TRAVEL in descending order of NO. (ii) To display the NAME of all the travellers from the table TRAVEL who are travelling by vehicle with code 101 or 102. ‘ (iii) To display the NO and NAME of those travellers from the table TRAVEL who travelled between ’2015-12-31’ and ‘2015-04-01’. (iv) To display all the details from table TRAVEL for the travellers, who have travelled distance more than 100 KM in ascending order of NOP.

Question 5: Consider the following  DEPT  and  WORKER  tables. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii):  Delhi 2015   NOTE DOJ refers to Date of Joining and DOB refers to Date of Birth of workers. (i) To display WNO, NAME,, GENDER from the table WORKER in descending order of WNO. (ii) To display the NAME of all the FEMALE workers from the table WORKER. (iii) To display the WNO and NAME of those workers from the table WORKER, who are born between ‘1987-01-01’ and ‘1991-12-01’. (iv) To count and display MALE workers who have joined after ‘1986-01-01’.

  Question 6:  Consider the following  DEPT  and  EMPLOYEE  tables. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii).  All India 2015     NOTE  DOJ refers to Date of Joining and DOB refers to Date of Birth of employees. (i) To display ENO, NAME, GENDER from the table EMPLOYEE in ascending order of ENO. (ii) To display the NAME of all the MALE employees from the table EMPLOYEE. (iii) To display the ENO and NAME of those employees from the table EMPLOYEE who are born between ‘1987-01-01’ and ‘1991-12-01’. (iv) To count and display FEMALE employees who have joined after ‘1986-01-01’.

Question 7: Consider the following tables  SCHOOL  and  ADMIN   and answer (a) and (b) parts of this question :  All India 2014 c  (a) Write SQL statements for the following: (i) To display TEACHERNAME, PERIODS of all teachers whose periods are more than 25. (ii) To display all the information from the table SCHOOL in descending order of experience. (iii) To display DESIGNATION without duplicate entries from the table ADMIN. (iv) To display TEACHERNAME, CODE and corresponding DESIGNATION from tables SCHOOL and ADMIN of Male teachers. (b) Give the output of the following SQL queries :

Question 8: Answer the questions (a) and (b) on the basis of the following tables  STORE  and  ITEM .  Delhi 2014 (a) Write the SQL queries (i) to (iv): (i) To display IName and Price of all the Items in ascending order of their Price. (ii) To display SNo and SName of all Store located in CP. (iii) To display Minimum and Maximum Price of each IName from the table ITEM. (iv) To display IName, Price of all items and their respective SName where they are available. (b) Write the output of the following SQL commands (i) to (iv):

  Question 9: Answer the questions (a) and (b) on the basis of the following tables SHOPPE  and  ACCESSORIES .  All India 2014 (a) Write the SQL queries: (i) To display Name and Price of all the accessories in ascending order of their Price. (ii) To display Id and SName of all Shoppe located in Nehru Place. (iii) To display Minimum and Maximum Price of each Name of accessories. (iv) To display Name, Price of all accessories and their respective SName where they are available. (b) Write the output of the following SQL commands:

Answer: (a)(i) SELECT Name, Price FROM ACCESSORIES ORDER BY Price ASC; (ii) SELECT ID, SName FROM SHOPPE WHERE Area = ‘Nehru Place’; (iii) SELECT MIN(Price)”Minimum Price”, MAX(Price)”Maximum Price”, Name FROM ACCESSORIES GROUP BY Name; (iv) The query for this statement cannot be done because relation column, i.e. foreign key is not present.  Question 10: Write SQL queries for (a) to (f) and write the outputs for the SQL queries mentioned shown in (i) to (iv) parts on the basis of tables  PRODUCTS  and  SUPPLIERS .  All India 2013     (a) To display the details of all the products in ascending order of product names (i.e. PNAME). (b) To display product name and price of all those products, whose price is in the range of 10000 and 15000 (both values inclusive). (c) To display the number of products which are supplied by each supplier, i.e. the expected output should be

(d) To display the price, product name (i.e. PNAME) and quantity (i.e. QTY) of those products which have quantity more than 100. (e) To display the names of those suppliers, who are either from DELHI or from CHENNAI. (f) To display the name of the companies and the name of the products in descending order of company names. (g) Obtain the outputs of the following SQL queries based on the data given in tables PRODUCTS and SUPPLIERS:

Question 11: Write SQL queries for (a) to (f) and write the outputs for the SQL queries mentioned shown in (i) to (iv) parts on the basis of tables ITEMS and TRADERS.  Delhi 2013   (a) To display the details of all the items in ascending order of item names (i.e. INAME). (b) To display item name and price of all those items, whose price is in the range of 10000 and 22000 (both values inclusive). (c) To display the number of items, which are traded by each trader. The expected output of this query should be

(d) To display the price, item name (i.e. INAME) and quantity (i.e. QTY) of those items which have quantity more than 150. (e) To display the names of those traders, who are either from DELHI or from MUMBAI. (f) To display the name of the companies and the name of the items in descending order of company names. (g) Obtain the outputs of the following SQL queries based on the data given in tables ITEMS and TRADERS:

  Question 12: Write SQL queries for (a) to (f) and write the outputs for the SQL queries mentioned shown in (i) to (iv) parts on the basis of tables  APPLICANTS  and  COURSES .  Delhi (C) 2013   (a) To display name, fee, gender, joinyear about the applicants, who have joined before 2010. (b) To display the names of applicants, who are paying fee more than 30000. (c) To display names of all applicants in ascending order of their joinyear. (d) To display the year and the total number of applicants joined in each YEARfrom the table APPLICANTS. (e) To display the CJD (i.e. Course ID) and the number of applicants registered in the course from the APPLICANTS table. (f) To display the applicant’s name with their respective course’s name from the tables APPLICANTS and COURSES. (g) Give the output of following SQL statements:

Question 13: Consider the following tables CABHUB and CUSTOMER and answer (a) and (b) parts of this question:  Delhi 2012 (a) Write SQL commands for the following statements: (i) To display the names of all the white colored vehicles. (ii) To display name of vehicle, make and capacity of vehicles in ascending order of their  setting Capacity. (iii) To display the highest charges at which a vehicle can be hired from CABHUB. (iv) To display the customer names and the corresponding name of the vehicle hired by them. (b) Give the output of the following SQL queries :

(iii) This query will execute but COUNT (*) will give result one row and Make will give more than one row so both are not compatible together. But on removing Make from select clause it will give following result. Question 14: Consider the following tables  CUSTOMER  and  ONLINESHOP . Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).  Delhi (C) 2012 (i) To display cname, area of fill female customers from CUSTOMER table. (ii) To display the details of all the customers in ascending order of CNAME within SID. (iii) To display the total number of customers for each area from CUSTOMER table. (iv) To display cname and corresponding shop from CUSTOMER table and ONLINESHOP table.

Question 15: Consider the following tables  CARDEN  and  CUSTOMER  and answer (a) and (b) parts of this question:  All India 2012   (a) Write SQL commands for the following statements: (i) To display the name of all the SILVER colored cars. (ii) To display name of car, make and capacity of cars in descending order of their sitting capacity. (iii) To display the highest Charges at which a vehicle can be hired from CARDEN. (iv) To display the customer names and the corresponding name of the cars hired by them, (b) Give the output of the following SQL queries:

Question 16: Consider the following tables EMPLOYEE and SALGRADE and answer (a) and (b) parts of this question:  All India 2011   (a) Write SQL commands for the following statements: (i) To display the details of all the EMPLOYEE in descending order of DOJ. (ii) To display name and desig of those EMPLOYEE, whose sgrade is either S02 or S03. (iii) To display the content of all the EMPLOYEE table, whose DOJ is in between ‘09-FEB-2006’ and ‘08-AUG-2009’. (iv) To add a new row in the EMPLOYEE table with the following data: 109, ‘Harish Roy’, ‘HEAD-IT, ‘S02’, ‘09-SEP-2007’, ‘21-APR-1983’. (b) Give the output of the following SQL queries:

  Question 17: Consider the following tables WORKER and PAYLEVEL and answer (a) and (b) parts of this question:  Delhi 2011    (a) Write SQL commands for the following statements: (i) To display the details of all WORKER in descending order of DOB. (ii) To display name and desig of those WORKER, whose plevel is either P001 or P002. (iii) To display the content of all the WORKER table, whose DOB is in between ‘19-JAN-1984’ and T8-JAN-1987’. (iv) To add a new row with the following: 19, ‘Daya Kishore’, ‘Operator’, ‘P003’, ‘19-JUN-2008’, ‘11-JUL-1984’. (b) Give the output of the following SQL queries:

Question 18: Consider the following tables STORE and SUPPLIERS and answer  (a) and (b) parts of this question:  Delhi 2010 (a) Write SQL commands for the following statements: (i) To display details of sill the items in the STORE table in ascending order of LastBuy. (ii) To display ItemNo and Item of those items from STORE table whose Rate is more than Rs. 15. (iii) To display the details of those items whose supplier code (Scode) is 22 or quantity in store (Qty) is more than 110 from the table STORE. (iv) To display minimum Rate of items for each supplier individually as per Scode from the table STORE. (b) Give the output of the following SQL queries:

Question 19: Consider the following tables STOCK and DEALERS and  answer (a) and (b) parts of this question:  All India 2010 (a) Write SQL commands for the following statements: (i) To display details of all the items in the STOCK table in ascending order of StockDate. (ii) To display ItemNo and ItemName of those items from STOCK table whose UnitPrice is more than Rs. 10. (iii) To display the details of those items whose dealer code (Dcode) is 102 or quantity in stock (Qty) is more than 100 from the table STOCK. (iv) To display maximum UnitPrice of items for each dealer individually as per Dcode from the table STOCK. (b) Give the output of the following SQL queries:

Question 20: Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).  Delhi 2009   (i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE. (ii) To display the details of all the GARMENT, which have READYDATE in between 08-DEC-07 and 16-JUN-08 (inclusive of both the dates). (iii) To display the average PRICE of all the GARMENT, which are made up of fabric with FCODE as F03. (iv) To display fabric wise highest and lowest price of GARMENT from GARMENT table. (Display FCODE of each GARMENT alongwith highest and lowest Price).

  Question 21: Consider the following tables DRESS and MATERIAL. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).  All India 2009 (i) To display DCODE and DESCRIPTION of each dress in ascending order of DCODE. (ii) To display the details of all the dresses which have LAUNCHDATE in between 05-DEC-07 and 20- JUN-08 (inclusive of both the dates). (iii) To display the average PRICE of all the dresses which are made up of material with MCODE as M003. (iv) To display materialwise highest and lowest price of dresses from DRESS table, (display MCODE of each dress alongwith highest and lowest price).

  Question 22:  Consider the following tables STUDENT and STREAM. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).  Delhi (C) 2009   (i) To display the name of streams in alphabetical order from table STREAM. (ii) To display the number of students whose POINTS are more than 5. (iii) To update GRADE to ‘A’ for all those students who are getting more than 8 as POINTS. (iv) ARTS+MATHS stream is no more available. Make necessary change in table fjTREAM.

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.