wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

SQL TEST

Total questions: 10

Worksheet time: 4mins

Name
Class
Date
1.

Which SQL statement adds a new column named 'Email' to the ‘Students' table?

a)

ALTER TABLE Students ADD COLUMN Email varchar(255);

b)

ALTER Students ADD COLUMN Email varchar(255);

c)

ALTER TABLE Students ADD Email varchar(255);

d)

MODIFY TABLE Students ADD Email varchar(255);

2.

What will the following SQL statement do?
ALTER TABLE Students
DROP COLUMN Email;

a)

Delete all records in the 'Email' column.

b)

Delete all data from a table.

c)

Change the data type of the 'Email' column.

d)

Delete the 'Email' column from the ‘Students' table.

3.

What does the SQL ALTER TABLE 
statement allow you to do?

a)

Create a new table in the database.

b)

Add, delete, or modify columns in an existing table.

c)

Delete all data from a table.

d)

Insert data into a table

4.

Which syntax is correct for changing the data type of a column in SQL?

ALTER TABLE Table_name …

a)

ALTER COLUMN Column_name Datatype ;

b)

CHANGE  Column_name Datatype;

c)

MODIFY Datatype TO Column_name ;

d)

ALTER COLUMN  Datatype  Column_name;

5.

How do you add a PRIMARY KEY 
to the '
ID' column in an existing table named  Persons’?

a)

ALTER TABLE Persons SET PRIMARY KEY (ID);

b)

ALTER TABLE Persons MODIFY PRIMARY KEY (ID);

c)

ALTER TABLE Persons ADD PRIMARY KEY (ID);

d)

ALTER TABLE Persons PRIMARY KEY ID;

6.

What is the primary purpose of the SQL CREATE TABLE statement?

a)

To insert data into a table

b)

To join a table

c)

To create a new table in a database

d)

To delete a table from a database

7.

What does the 'DATATYPE' parameter in the CREATE TABLE statement specify?

a)

The type of data the column can hold

b)

The default value of the column

c)

The name of the column

d)

The primary key for the column

8.

Which of the following is NOT a string data type in SQL?

a)

VarChar

b)

Symbol

c)

Text

d)

Character

9.

A floating point number can be defined using FLOAT or …?...

a)

INTEGER

b)

NUMERIC

c)

REAL

d)

BOOLEAN

10.

Which of the following is the correct format for the DATE data type?

a)

DD-MM-YYYY

b)

MM/DD/YYYY

c)

YYYY/MM/DD

d)

YYYY-MM-DD