Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL 3

Total questions: 14

Worksheet time: 10mins

Name
Class
Date
1.

SQL stands for (a)   .

Choose from the below words
Strong Question Language
Structured Question Language
Structured Query Language
Seequal Language
2.

Which of the following best describes the function of a primary key in a database?

a)

A method to secure database access

b)

A unique identifier for each record

c)

A way to enhance the performance of database queries

d)

A tool for defining relationships between tables

3.

Select the appropriate SQL query to show...

The title and description of all reviews for products that cost less than £100.

a)

SELECT title, description

FROM Product, Review

WHERE Product.ProductID = Review.ProductID

AND Price < 100

b)

SELECT title, description

FROM *

WHERE Price < 100

c)

SELECT *

FROM Product, Review

WHERE Product.ProductID = Review.ProductID

d)

SELECT title, description

FROM Product

WHERE Product.ProductID = Review.ProductID

AND Price <= 100

4.

Which word is missing from the following SQL statement?


SELECT * table_name

a)

WITH

b)

WHERE

c)

FROM

d)

AND

5.

How would we script a SQL query to select "Description" from the Item table?

a)

SELECT Item.Description

b)

EXTRACT Description FROM Item

c)

SELECT Item FROM Description

d)

SELECT Description FROM Item

6.

Which query would return only the fields DesignerID and Designer?

a)

SELECT * FROM Designers

b)

SELECT DesignerID, Name FROM Designers

c)

SELECT DesignerID AND Designer FROM Designers

d)

SELECT DesignerID, Designer FROM Designers

7.

You are required to update the phone number for only the DesignerID "SMI01" in the "Designer" table. Which of these would successfully do that?

a)

UPDATE Designer SET PhoneNo = '01224123456'

b)

UPDATE Designer (PhoneNo) VALUES ('01224123456')

c)

UPDATE Designer SET PhoneNo = '01224123456' WHERE DesignerID = 'SMI01'

d)

UPDATE PhoneNo = '01224123456' FROM Designer WHERE DesignerID = 'SMI01'

8.

With SQL how can I return all items in the Item table sorted from the lowest priced to the highest priced?

a)

SELECT * FROM Items ORDER BY Price ASCENDING

b)

SELECT * FROM Items ORDER BY Price ASC

c)

SELECT * FROM Items BY Price LOWEST TO HIGHEST

d)

SELECT * FROM Items ORDER BY Price DESC

9.

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

10.

Which SQL statement would add a record to the database?

a)

INSERT INTO Designer VALUES ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456')

b)

INSERT VALUES ('SMI01', 'M Smith', 'mail@msmith.com', 01224123456') INTO Designer

c)

INSERT ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456') INTO Designer

d)

INSERT Designer INTO VALUES (''SMI01', 'M Smith', 'mail@msmith.com', '01224123456')

11.

(a)   <list of fields>​ (b)   <name of table> ​ (c)   <logical condition> ​ (d)   ​ <field name> (e)  

Choose from the below words
SELECT
FROM
WHERE
ORDER BY
ASC | DESC
12.

When using the UPDATE command, you need to specify the fields to update.

Why don't you need to do this for the DELETE command?

a)

Because you can only delete the entire record

b)

Because DELETE has additional logic

c)

Because UPDATE is more flexible

d)

Because this functionality is not yet in SQL

13.

In databases, what is a foreign key?

a)

A field in a table that's a primary key in another table

b)

A field that uniquely identifies each record

c)

A key that is used to encrypt information in the database

d)

An optional field that can be copied between tables

14.

To get information from more than one table we need to join them together.

In this case, what TWO jobs does the 'WHERE' clause do? (PICK 2)

a)

Implicitly join the tables

b)

Filter the results according to a logical condition(s)

c)

Copy foreign keys between tables to make links

d)

Sort the results ascending or descending