THE PSBB MILLENNIUM SCHOOL GERUGAMBAKKAM - CHENNAI
COMPUTER SCIENCE (083) CLASS 12
STRUCTURED QUERY LANGUAGE - WORKSHEET 1
1 The SELECT statement when combined with clause, returns records without repetition.
(A) DISTINCT (B) DESCRIBE (C) UNIQUE (D) NULL
2 Which function is used to display the total number of records from a table in a
database?
(A) total() (B) total(*) (C) return(*) (D) count(*)
3 Fill in the blank: command is used to change table structure in SQL.
(A) update (B) change (C) alter (D) modify
4 Which of the following commands will remove the entire database from MYSQL?
(A) DELETE DATABASE (B) DROP DATABASE
(C) REMOVE DATABASE (D) ALTER DATABASE
5 is a non-key attribute, whose values are derived from the primary key of
some other table.
(A) Primary Key (B) Candidate Key (C) Foreign Key (D) Alternate Key
6
Which of the following statements is True?
a) There can be only one Foreign Key in a table.
b) There can be only one Unique key is a table
c) There can be only one Primary Key in a Table
d) A table must have a Primary Key
7 Which of the following is not part of a DDL query?
a) DROP b) MODIFY c) DISTINCT d) ADD
8 Keyword is used to obtain unique values in a SELECT query
a) UNIQUE b) DISTINCT c) SET d) HAVING
9
Which statement in MySql will display all the tables in a database?
a) SELECT * FROM TABLES; b) USE TABLES;
c) DESCRIBE TABLES; d) SHOW TABLES;
10 Which of the following is a valid sql statement?
a) ALTER TABLE student SET rollnoINT(5);
b) UPDATE TABLE student MODIFY age = age + 10;
c) DROP FROM TABLE student;
d) DELETE FROM student;
11 Which of the following commands will delete the rows of table?
(a) DELETE command (b) DROP Command
(c) REMOVE Command (d) ALTER Command
12
Which of the following ignores the NULL values inSQL?
a) Count(*) b) count() c)total(*) d)None of these
13
Which of the following statements is True?
a) There can be only one Foreign Key in a table.
b) There can be only one Unique key is a table
c) There can be only one Primary Key in a Table
d) A table must have a Primary Key
14
The SQL built-in function calculates the average of values in numeric columns.
(a) MEAN() (b)AVG() (c) AVERAGE() (d) COUNT()
15 When two conditions must both be true for the rows to be selected, the conditions are
separated by the SQL keyword
(a)ALL (b)IN (c)AND (d)OR
16 Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give example
to support your answer
17 A MySQL table, SALES has 10 rows.
The following queries were executed on the sales table.
SELECT COUNT(*) FROM sales; SELECT COUNT(discount) FROM sales;
COUNT(*) COUNT(discount)
10 6
Write a statement to explain as to why there is a difference in both the counts
18
(a) SELECT min(Population) FROM country;
(b) SELECT max(SurfaceArea) FROM country Where Lifeexpectancy<50;
(c) SELECT avg(LifeExpectancy) FROM country Where CName Like "%G%";
(d) SELECT Count(Distinct Continent) FROM country;
19 Differentiate between ‘WHERE’ clause and ‘HAVING’ clause in MySQL with
appropriate examples.
20 Differentiate between DELETE and DROP keywords used in MySQL,giving suitable example
for each