wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Referential and Where

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

In order to modify data in a database we would use which SQL statement?

a)

Update

b)

Amend

c)

Alter

d)

Modify

2.

Referential Integrity is

a)

System of rules

b)

System of data

c)

Table constraints

d)

is related to Primary key

3.

A primary key can be NULL in the table? TRUE or FALSE

a)

TRUE

b)

FALSE

4.

Select DDL commands from among the options...

a)

SELECT

b)

ALTER

c)

DROP

d)

DELETE

5.

The primary key of a table which is present in another table for referencing is known as (a)  

6.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?

a)

SELECT * FROM Persons WHERE FirstName=’a’

b)

SELECT * FROM Persons WHERE FirstName LIKE ‘a%’

c)

SELECT * FROM Persons WHERE FirstName LIKE ‘%a’

d)

SELECT * FROM Persons WHERE FirstName=’%a%’

7.

What does the ALTER TABLE clause do?

a)

The SQL ALTER TABLE clause modifies a table definition by altering, adding, or deleting table columns and/or constraints

b)

The SQL ALTER TABLE clause is used to insert data into database table

c)

THE SQL ALTER TABLE deletes data from database table

d)

The SQL ALTER TABLE clause is used to delete a database table

8.

How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?

a)

UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’

b)

MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

c)

MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’

d)

UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

9.

SQL query to find all the cities whose humidity is 95.

a)

SELECT city WHERE humidity = 95

b)

SELECT city FROM weather WHERE humidity = 95

c)

SELECT humidity = 89 FROM weather

d)

SELECT city FROM weather

10.

Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.

a)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70

b)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70

c)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70

d)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70

11.

The command to remove rows from a table ‘CUSTOMER’ is __________________

a)

DROP FROM CUSTOMER

b)

UPDATE FROM CUSTOMER

c)

REMOVE FROM CUSTOMER

d)

DELETE FROM CUSTOMER WHERE

12.

If you were wanting to filter data, which clause would you use?

a)

Where

b)

Order by

c)

From

d)

Select

13.

Using which word allows you to specify that more than one condition must be met in a query?

a)

Also

b)

And

c)

Or

d)

Where

14.

Using which word allows you to specify that only one of a series of conditions needs to be met in a query filter?

a)

And

b)

Maybe

c)

If

d)

Or

15.

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'

16.

How would you DELETE records from the Items table with a "Chair" Type?

a)

DELETE 'Chair' FROM Items

b)

DELETE Type FROM Items WHERE Type = 'Chair'

c)

DELETE FROM Items WHERE Type = 'Chair'

d)

DELETE ITEMS WHERE Type = 'Chair'

17.

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

18.

A field in one table that is the primary key of another table and establishes a relationship between the two tables

a)

Primary Key

b)

Foreign Key

c)

House Key

d)

Attribute

19.
What is a foreign key?
a)
 A foreign key is a primary key that appears in another table to create a relationship between the two tables
b)
 A foreign key is a field that does not belong in that table
c)
 A foreign key is a field that is a unique identifier in that entity
20.

The table with the primary key is called the referenced or ............ table.

a)

PARENT

b)

CHILD

c)

HYBRID