Professional Documents
Culture Documents
11 Computer Science
11 Computer Science
1.
a) Which operator is used for checking a list of values in MySQL? Give example. [1]
b) Which operator is used for making range checks in queries? [1]
c) Which command is used in MySQL to make the changes permanent? [1]
d) A table ‘Customer’ in a database has 5 columns and no rows in it. What is its degree and
cardinality? What will be its cardinality if 4 rows are added in the table? [2]
e) Find errors in the following query and write the correct command. [2]
i. Select * from student where stream = “null” ;
ii. Select * from student where marks is between 40 to 60 ;
f) Write the pattern matching symbols used in MySQL. [1]
3. Study the following table STAFF and give outputs for SQL queries [4]
TABLE: STAFF
ID NAME DEPT SEX EXPERIENCE
101 Siddharth SALES M 12
104 Raghav FINANCE M 5
107 Naman RESEARCH M 10
114 Nupur SALES F 3
109 Janvi FINANCE F 9
105 Rama M 10
117 James SALES F 3
111 Binoy FINANCE F 12
130 Samuel SALES M 15
a. Select name, dept from Staff where sex=’F’ and experience>5;
b. Select id, experience from Staff where dept is not null and name like ‘B%’;
c. Select name, experience from staff where id in (114,110,134);
d. Select id, sex from Staff where experience between 5 and 7;
5. Consider the table STUDENT given below. Write commands in MySql for (i) to (iii) and output
for (iv) to (vi):
Table: STUDENT
No Name Stipend Subject Average Division
1 Sharon 400 English 38 THIRD
2 Amal 680 Mathematics 72 FIRST
3 Vedant 500 Accounts 67 FIRST
4 Shakeer 200 Informatics 55 SECOND
5 Anandha 400 History 85 FIRST
6 Upasna 550 Geagraphy 45 THIRD
i. To display a report listing NAME, SUBJECT and Annual stipend received assuming that the
stipend column has monthly stipend. [1]
ii. To count the number of students, who have either Accounts or Informatics as Subject. [1]
iii. To insert a new row in the table STUDENT: [1]
6,”Mohan”,500, “English”,73, “Second”
iv. SELECT AVG(Stipend) FROM STUDENT WHERE DIVISION=”THIRD”; [1]
v. SELECT COUNT(DISTINCT subject) FROM STUDENT; [1]
vi. SELECT MIN(Average) FROM STUDENT WHERE Subject=”English” [1]
-x-x-x-x-x-x-x-x-