Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL BASICS

Total questions: 25

Worksheet time: 9mins

Name
Class
Date
1.

 

Which one will delete the table data as well as table structure?

a)

DROP

b)

TRUNCATE

c)

ALTER

d)

DELETE

2.

Drag the options into the correct boxes to complete the query

To display the detail of employee having "e" in their name in descending order of salary

SELECT * ​ (a)   emp ​ (b)   ename ​ (c)   %e%" ​ (d)   SAL ​ (e)   ;

Choose from the below words
FROM
WHERE
LIKE "
ORDER BY
DESC
3.

(a)   is used to eliminate duplicate values

4.

Match the following

a)

DDL

1.

ALTER

b)

DML

2.

UPDATE

c)

DCL

3.

REVOKE

d)

TCL

4.

ROLLBACK

5.

Which operator is used to specify the RANGE of values

a)

RANGE from

b)

FROM .. TO

c)

Between .. and

d)

Between range

6.

Reorder the following to get a correct query

display the username and password of all users

a)

select

b)

username

c)

password

d)

from

e)

users

1)
2)
3)
4)
5)
7.

 

A (a)   constraint enforces referential Integrity

8.

 

A subquery in an SQL SELECT statement is enclosed in:

a)

Braces -- {...}

b)

Single Quotes ' ...'

c)

Parenthesis (...)

d)

brackets [..]

9.

Reorder the following to get the correct order of clauses in select statement.

a)

FROM

b)

WHERE

c)

GROUP BY

d)

HAVING

e)

ORDER BY

1)
2)
3)
4)
5)
10.

Which type of join will automatically find the common column for joining tables?

a)

Inner Join

b)

Equi Join

c)

Outer Join

d)

Natural Join

11.

Match the following

a)

Pattern matching

1.

Like

b)

Sort the output

2.

Order by

c)

Structure of a table

3.

Desc

d)

Add a new column

4.

Alter

e)

Change the Values

5.

Update

12.

Which of the following queries is valid

a)

SELECT name, course_name FROM student WHERE age>50 and <80;   

b)

SELECT name, course_name FROM student WHERE age>50 and age <80;

c)

SELECT name, course_name FROM student WHERE age>50 and WHERE age<80;

d)

None of these

13.

Which of the following is used to delete columns

a)

MODIFY TABLE TableName DROP ColumnName

b)

MODIFY TABLE TableName DROP COLUMN ColumnName

c)

ALTER TABLE TableName DELETE ColumnName

d)

ALTER TABLE TableName DROP COLUMN ColumnName   

14.

Consider the following Table.

STUDENTS(student_code, first_name, last_name, email, phone_no, date_of_birth, honours_subject, percentage_of_marks);

Which of the following query would display names of all the students whose email ids are not provided?

a)

SELECT first_name, last_name FROM students WHERE email=0;

b)

SELECT first_name, last_name FROM students WHERE email='null';

c)

SELECT first_name, last_name FROM students WHERE email ='NULL'

d)

SELECT first_name, last_name FROM students WHERE email is null;

15.

Find the temperature in increasing order of all cities

SELECT ​ (a)   ,​ (b)   ​ (c)   wheather ​ (d)   ​ ​ (e)  

Choose from the below words
city
temperature
from
order by
16.

In an SQL SELECT statement querying a single table, the asterisk (*) means that:

a)

all records are to be returned.

b)

None the options is correct.

c)

All columns of the table are to be returned

d)

All records meeting the full criteria are to be returned.

17.

Match the following

a)

Single row function

1.

round

b)

operator

2.

In

c)

aggregate function

3.

min

d)

clause

4.

where

e)

statement

5.

select

18.

How can you change "Thomas" into "Michel" in the "LastName" column in the Users table?

a)

UPDATE User SET LastName = 'Thomas' INTO LastName = 'Michel'

b)

MODIFY Users SET LastName = 'Michel' WHERE LastName = 'Thomas'

c)

MODIFY Users SET LastName = 'Thomas' INTO LastName = 'Michel'

d)

UPDATE Users SET LastName = 'Michel' WHERE LastName = 'Thomas'

19.

------- statement is used to establish an IF-THEN-ELSE in SQL

(a)  

20.

Reorder the following for the correct sequence of order of sql select statement.

a)

select

b)

from

c)

where

d)

group by

e)

having

1)
2)
3)
4)
5)
21.

Match the following

a)

Primary Key

1.

Unique identifier

b)

Unique

2.

allow Null values

c)

Not Null

3.

Don't allow null values

d)

Foreign Key

4.

referential constraint

e)

check

5.

Condition must be true

22.

Which of the following statement is correct regarding the difference between TRUNCATE and DELETE,DROP commands?

a)

DELETE will free the space while TRUNCATE and DROP will not free the space

b)

TRUNCATE and DROP operations can be rolled back but DELETE operations cannot be rolled back.

c)

DELETE and TRUNCATE remove the records but keeps the structure.

d)

DELETE is DDL while TRUNCATE and DROP are DML

23.

Which of the following statement is correct to display all the cities with the condition, temperature, and humidity whose humidity is in the range of 60 to 75 from the 'whether' table?

a)

SELECT * FROM weather WHERE humidity IN (60 to 75)

b)

SELECT * FROM weather WHERE humidity BETWEEN 60 AND 75

c)

SELECT * FROM weather WHERE humidity NOT IN (60 AND 75)

d)

SELECT * FROM weather WHERE humidity NOT BETWEEN 60 AND 75

24.

Match the following

a)

Alter

1.

Add or remove columns

b)

Update

2.

Modify the existing values

c)

revoke

3.

Remove permission

d)

rollback

4.

Undo the changes

e)

Delete

5.

Remove a record

25.

Which of the following is a valid column name

a)

1year

b)

first year

c)

first.year

d)

year1