The document is an assessment paper with questions related to SQL and database concepts. It includes fill-in-the-blank questions, true or false statements, definitions, and SQL command writing tasks. The questions cover topics such as primary keys, SQL commands, cardinality, and various SQL queries related to given tables.
The document is an assessment paper with questions related to SQL and database concepts. It includes fill-in-the-blank questions, true or false statements, definitions, and SQL command writing tasks. The questions cover topics such as primary keys, SQL commands, cardinality, and various SQL queries related to given tables.
The document is an assessment paper with questions related to SQL and database concepts. It includes fill-in-the-blank questions, true or false statements, definitions, and SQL command writing tasks. The questions cover topics such as primary keys, SQL commands, cardinality, and various SQL queries related to given tables.
The document is an assessment paper with questions related to SQL and database concepts. It includes fill-in-the-blank questions, true or false statements, definitions, and SQL command writing tasks. The questions cover topics such as primary keys, SQL commands, cardinality, and various SQL queries related to given tables.
Select * from student where admno between 1101 _______ 1199;. 2 Fill in the Blanks. 1 ____________ command is used to view the structure of the table. 3 State TRUE or FALSE. 1 DELETE is DDL command. 4 State TRUE or FALSE. 1 COUNT() will count NULL values. 5 Define Primary Key. 1 6 Write the difference between CHAR and VARCHAR. 1 7 What is the purpose of BETWEEN Clause? 1
8 Write the full form of SQL. 1
9 Which command is used to change the database? 1
(a) Open (b) Change (c) Use (d) Select 10 Which is not a category of SQL command? 1 (a) DDL (b) XML (c) DML (d) TCL 11 Number of rows in a relation is known as 1 (a) Degree (b) Cardinality (c) Cartesian Product (d) Attribute 12 A Table customer contains 5 rows and 7 columns. What will be its cardinality and 1 degree? (a) Degree 7, Cardinality 5. (b) Degree 5, Cardinality 7. (c) Degree 5, Cardinality 7. (d) Cardinality 7, Degree 7. 13Observe the following STUDENTS and EVENTS tables carefully and write the name 2 of the RDBMS operation which will be used to produce the output as shown in LIST ? Also, find the Degree and Cardinality of the LIST.
14 What is an Alternate Key? 2
15Observe the table ‘Club’ given below: 3
Table: Club Member_id Member_Name Address Age Fee M001 Sumit New Delhi 20 2000 M002 Nisha Gurgaon 19 3500 M003 Niharika New Delhi 21 2100 M004 Sachin Faridabad 18 3500 (i) What is the cardinality and degree of the above given table? (ii) If a new column contact_no has been added and three more members have joined the club then how these changes will affect the degree and cardinality of the above given table. 16 Observe the following table and answer the parts (i) and (ii) accordingly 3 Table: Product Pno Name Qty PurchaseDate 101 Pen 102 12-12-2011 102 Pencil 201 21-02-2013 103 Eraser 90 09-08-2010 109 Sharpener 90 31-08-2012 113 Clips 900 12-12-2011 (a) Write the names of most appropriate columns, which can be considered as candidate keys. (b) What is the degree and cardinality of the above table? 17Write SQL commands for the following: 4 Table: TEACHER TID NAME AGE DEPT DATEOFJOIN SAL SEX T118 Navin 40 Computer 2010-01-10 12000 M T107 Chetna 37 History 2008-03-24 20000 F T105 Sandeep 46 Maths 2006-12-12 30000 M T110 Sangeeta 35 History 2010-07-01 25000 F T101 Rudransh 42 Maths 2004-09-05 40000 M T121 Neeraj 38 Physics 2011-04-01 28000 M (i) To show information about the teachers of the history department. (ii) To list the names of teachers earning a salary between 20000 and 30000. (iii) To count the number of male teachers. (iv) Display gender wise total number of teachers. (v) To list the name and age of teachers of female teachers in descending order of date of join. (vi) Increase the salary by 10% for Maths departments. ( vii) To delete the record of teacher Neeraj. 18Consider the following table HOSPITAL. 4 Table: HOSPITAL PNo Name Age Department DateofAdm Charges Sex 1 Mayank 65 Surgery 23/02/2018 600 M 2 Babita 24 ENT 01/01/2019 400 F 3 Kashish 45 Orthopaedic 19/12/2018 400 M 4 Tarun 12 Surgery 01/10/2018 600 M 5 Manisha 36 ENT 12/01/2018 400 F 6 Imran 16 ENT 24/02/2018 400 M 7 Ankita NULL Cardiology 20/08/2018 800 F 8 Zoya 45 Gynecology 22/02/2018 500 F 9 Kush 19 Cardiology 13/01/2019 800 M 10 Shalini 31 Medicine 19/02/2018 300 F Note: PNo is the primary key in the above table. Write SQL commands for the statements (a) to (g) on the table HOSPITAL. (a) To show all the information about the patients of the cardiology department. (b) To list the names of female patients who are either in the orthopaedic or surgery department. (c) To list the name of all the patients with their date of admission in ascending order. (d) To display the patient’s name, charges, the age for female patients only. (e) To count the number of patients with age > 30. (f) To display various departments. (g) To display the number of patients in each department. 19Write SQL queries for (a) to (f) and write the outputs for the SQL queries mentioned 5 shown in (g1) to (g4) parts on the basis of tables ITEMS and TRADERS: [Delhi 2013] Table: ITEMS CODE INAME QTY PRICE COMPANY TCODE DIGITAL 1001 120 11000 XENITA T01 PAD 12i LED 1006 70 38000 SANTORA T02 SCREEN 40 CAR GPS 1004 50 21500 GEOKNOW T01 SYSTEM DIGITAL 1003 CAMERA 160 8000 DIGICLICK T02 12X PEN DRIVE 1005 600 1200 STOREHOME T03 32GB Table: TRADERS TCode TName CITY T01 ELECTRONIC SALES MUMBAI T03 BUSY STORE CORP DELHI T02 DISP HOUSE INC CHENNAI (a) To display the details of all the items in the ascending order of item names (i.e. INAME). (b) To display item name and price of all those items, whose price is in 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: T01 2 T02 2 T03 1 (d) To display the price, item name 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 names of the companies and the names of the items in descending order of company names. (g1) Select max(price), min(price) from items; (g2) Select price*qty amount from items where code=1004; (g3) Select distinct tcode from items; (g4) Select iname, tname from items i, traders t where i.tcode=t.tcode and qty<100; 20Consider the following DEPT and WORKER tables. Write SQL queries for (i) to (iv) 5 and find outputs for SQL queries (v) to (viii): [Delhi 2015] Table: DEPT DCODE DEPARTMENT CITY D01 MEDIA DELHI D02 MARKETING DELHI D03 INFRASTRUCTURE MUMBAI D05 FINANCE KOLKATA HUMAN D04 MUMBAI RESOURCE Table: WORKER WNO NAME DOJ DOB GENDER DCODE 1001 George K 2013-09-02 1991-09-01 MALE D01 1002 Ryma Sen 2012-12-11 1990-12-15 FEMALE D03 1003 Mohitesh 2013-02-03 1987-09-04 MALE D05 1007 Anil Jha 2014-01-17 1984-10-19 MALE D04 1004 Manila Sahai 2012-12-09 1986-11-14 FEMALE D01 1005 R SAHAY 2013-11-18 1987-03-31 MALE D02 1006 Jaya Priya 2014-06-09 1985-06-23 FEMALE D05 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’. (v) SELECT COUNT(*), DCODE FROM WORKER GROUP BY DCODE HAVING COUNT(*)>1; (vi) SELECT DISTINCT DEPARTMENT FROM DEPT; (vii) SELECT NAME, DEPARTMENT, CITY FROM WORKER W,DEPT D WHERE W.DCODE=D.DCODE AND WNO<1003; (viii) SELECT MAX(DOJ), MIN(DOB) FROM WORKER;