You are on page 1of 3

DOHA MODERN INDIAN SCHOOL

Grade: 12
Subject: Computer Science

SAMPLE QUESTIONS ON MYSQL

Q1. ) Which statement is wrong about PRIMARY KEY constraint in SQL?


A. The PRIMARY KEY uniquely identifies each record in a SQL database table
B. Primary key can be made based on multiple columns
C. Primary key must be made of any single columns
D. Primary keys must contain UNIQUE values.

Answer: C

Q2. ) Which is/are correct statements about primary key of a table?


A. Primary keys can contain NULL values
B. Primary keys cannot contain NULL values.
C. A table can have only one primary key with single or multiple fields
D. A table can have multiple primary keys with single or multiple fields

Answer: B and C

Q3. ) In existing table, ALTER TABLE statement is used to


A. Add columns
B. Add constraints
C. Delete columns
D. Delete constrains
E. All of the above

Answer: E

Q4. ) SQL Query to delete all rows in a table without deleting the table (structure, attributes, and
indexes)
A. DELETE FROM table_name;
B. DELETE TABLE table_name;
C. DROP TABLE table_name;
D. NONE

Answer: A

Q5.) If you want to allow age of a person > 18 in the column Age of table Person, then which
constraint will be applied to AGE column.
Default
Check
NOT NULL
None

Answer: B
Q6.) In a table, a column contains duplicate value, if you want to list all different value only, then
which SQL clause is used?
A. SQL DISTINCT
B. SQL UNIQUE
C. SQL BETWEEN
D. SQL Exists

Answer: A
Q7.) Which is called as a virtual table in SQL?

A. INNER JOIN
B. JOIN
C. VIEW
D. NONE

Answer: C
Q8. )Match SQL language with SQL commands

1)DDL i)Revok, Grant


2)DML ii)rename a table
3)TCL iii)insert, update
4)DCL iv)rollback , commit

A. 1-iii,2-i,3-ii,4-iv
B. 1-iii,2-ii,3-iv,4-i
C. 1-ii,2-iii,3-iv,4-i
D. 1-i,2-iii,3-ii,4-iv

Answer: C

Q9.)Which statement is correct? A table can have

A. many primary key and many unique key


B. one primary key and one unique key
C. one primary key and many unique key
D. many primary key and one unique key

Answer: C
Q10.) The HAVING clause does which of the following?

A) Acts EXACTLY like a WHERE clause


B) Acts like a WHERE clause but is used for columns rather than groups.
C) Acts like a WHERE clause but is used for groups rather than rows.

D) Acts like a WHERE clause but is used for rows rather than columns.

Answer: C

You might also like