wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL Programming

Total questions: 10

Worksheet time: 8mins

Name
Class
Date
1.

Write the correct SQL statement to create a new table called Persons

ـــــــــــــــــــــــــ (

PersonID int,

LastName varchar(255),

FirstName varchar(255),

Address varchar(255),

City varchar(255)

);

(a)  

2.

Select all records where the value of the City column starts with the letter "a".


SELECT * FROM Customers

(a)   ;

3.

Select all records where the City column has the value "Berlin"


SELECT * FROM Customers

ــــــــــــــــ City = "Berlin";

a)

INSERT

b)

SELECT

c)

DROP

d)

WHERE

4.

Select all records from the Customers table, sort the result alphabetically by the column City


SELECT * FROM Customers

ــــــــــــــــ City;

(a)  

5.

Select all the different values from the Country column in the Customers table


SELECT ـــــــــــــــــــــ Country FROM Customers;

a)

DISTICNT

b)

DISTINCT

c)

DITSINCT

d)

DISTINTC

6.

Select all records from the Customers where the PostalCode column is empty


SELECT * FROM Customers

WHERE PostalCode ــــــــــــــــــــــــــ ;

a)

IS EMPTY

b)

IS NULL

c)

NOT FILLED

7.

Update the City column of all records in the Customers table


ــــــــــــــــــ Customers

ــــــــــ City = "Oslo"

a)

UPDATE / MAKE

b)

UPGRADE / SET

c)

SET / UPDATE

d)

UPDATE / SET

8.

Delete all the records from the Customers table where the Country value is 'Norway'


ـــــــــــــــــــــ Customers

WHERE Country = 'Norway';

(a)  

9.

Write the correct SQL statement to create a new database called testDB


ــــــــــــــــــــــــــــــــــــــــــــــــــ ;

(a)  

10.

Add a column of type DATE called Birthday


ALTER TABLE Persons

ــــــــــــــــــــــــــــــ ;

(a)