wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL Queries - DDL

Total questions: 15

Worksheet time: 9mins

Name
Class
Date
1.

What will be the output of this query?

SELECT * FROM employees;

a)

Retrieve all rows in the employee database

b)

Retrieve all rows from the employee table

c)

Retrieve all columns from the employee database

d)

Retrieve all columns from employee table

2.

Question 2

How will a data analyst retrieve a list of all employees' first_name, last_name and hire_date from the employees table?

a)

select first_name,last_name,hire_date, from employee;

b)

select first_name,last_name and hire_date from employees;

c)

Select first_name,last_name& hire_date from employees;

d)

select first_name,last_name,hire_date from employees;

3.

Which of these SQL statements will select all the members with last names that start with capital letter "M" in the table member?

a)

select * from member where last_name="M%";

b)

select * from member where last_name="M-"

c)

Select * from member where last_name="M"

d)

select * from member where last_name like "M%"

4.

What will be the result of this query?

SELECT dept_name

FROM Departments

WHERE dept_no BETWEEN 'd003' AND 'd006';

a)

Select all department name whose department number is not between d003 and d006;

b)

select all department names whose department number is between d003 and d006;

c)

select a list of all departments whose department number is between d003 and d006;

5.

SELECT statement is a ...............in SQL

a)

Data Control Language(DCL)

b)

Transcation Control language(TCL)

c)

Data Manipulation language(DML)

d)

Data Definition language(DDL)

6.

COUNT is a .................function

a)

Aggregate

b)

procedure

c)

user-defined

d)

Summarizing

7.

Which of the following is a valid SQL statement to select all the members who live in T from the table member?

a)

select * from member

b)

select * from member where state_abbravation="T"

c)

select * from member where state_abbrevation=='T'

d)

select * from member where state_abbravation is T

8.

Difference between ALTER Table command and UPDATE command :

a)

ALTER is DDL command and is used for modifying the schema of table

b)

UPDATE is DML command and is

used for modifying the existing data of table

c)

Using Alter command any value inside the table can be modified.

d)

Using Update command columns of a table can be renamed.

9.

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

10.

Which of the following attributes can be considered as a choice for a primary key?

a)

Name

b)

Street

c)

RollNo

d)

Subject

11.

How would you display Chairs in the Items table that have a Price greater than £50.

a)

SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50

b)

SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100

c)

SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50

d)

SELECT * FROM Items WHERE Price > 50

12.
What is missing in this code? SELECT * FROM WHERE genre = ‘action’ ORDER BY year ASC;
a)
Missing an AND
b)
Table name
c)
Capitalize action
d)
None of these
13.

Which would find pupils with "er" anywhere in their name?

a)

SELECT * FROM Pupils Where Name = "%er"

b)

SELECT * FROM Pupils Where Name = "$er$"

c)

SELECT * FROM Pupils Where Name = "%er%"

d)

SELECT * FROM Pupils Where Name = "er%"

14.

Which of the following query contains error?

a)

SELECT * FROM Emp WHERE Empid=1001;

b)

SELECT Empid FROM Emp WHERE Empid=1001;

c)

SELECT Empid FROM Emp;

d)

SELECT Empid WHERE empid=1001;

15.

Which statement is used to count number of rows in table?

a)

SELECT COUNT(*) FROM table_name;

b)

SELECT COUNT ALL(*) FROM table_name;

c)

SELECT ROWS(*) FROM table_name;

d)

All the above