Copy of XI Periodic Test 2
Copy of XI Periodic Test 2
SECTION A
1. Consider the table with structure below,which attribute will form the 1
Primary key?
Student(ID,name,deptname,tot_cred)
The degree of student table from the above code snippet is:
(a) 30 (b) 1 (c) 3 (d) 4
4. The datatypes CHAR(n) and VARCHAR(n) are used to create _______ and 1
_________ types of string/text fields in a database.
(a) Fixed,equal (b) Equal, variable
(c) Fixed, variable (d) Variable, equal
SECTION B
7. Suppose that all the customers of a particular business live in states for 2
which the city name is unique. Given the following description for customer
data:
CUST-ID, CUST-NAME, STREET, CITY, STATE, PHONE)
1
(a) List the most likely attribute for the primary key.
SECTION C
SECTION D
12. (a) Write SQL command to create table ABC with following details: 2
(b) Write the command to now add the primary key on the column Rollno. 1
SECTION E
13. Write SQL commands for the following on the basis of given table SPORTS: 5
StNo Class Name Game1 Grade1 Game2 Grade2
10 7 Sameer Cricket B Swimming A
11 8 Sujit Tennis A Skating C
2
12 7 Kamal Swimming B Football B
13 7 Veena Tennis C Tennis A
14 9 Archana Basketball A Cricket A
(a) Display the names of the students who have grade 'A' in either Game1
or Game2 or both.
(b) Display the names of students who have the same game for both
Game1 and Game2.
(c) Display the games taken by the students whose name starts with 'A'.
(d) Give the output of the following sql statements:
(i) select count(*) from SPORTS;
(ii) select distinct Class from SPORTS;