Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL - Structured Query Language

Total questions: 12

Worksheet time: 13mins

Name
Class
Date
1.

Find all customers from Berlin

a)

SELECT * FROM Customers

b)

SELECT * FROM CustomerName

c)

SELECT * FROM Customers WHERE city = 'Berlin'

d)

FROM CustomersSELECT * WHERE city = 'Berlin'

2.

Find all customer names from whose postcode is 1000 or greater

(the table name is Customers)

(a)  

3.

Find all customer names whose names start with "Al"

(the table name is Customers)

(a)  

4.

All employee names who made an order in 1996

a)

SELECT FirstName, LastName FROM Employees, OrderID WHERE Employees.EmployeeID = Orders.EmployeeID AND OrderDate Like "1996%"

b)

SELECT EmployeeName FROM Employees, OrderID WHERE Employees.EmployeeID = Orders.EmployeeID AND OrderDate.year > 1996

c)

SELECT FirstName, LastName FROM Employees, WHERE Employees.EmployeeID = OrderDate = 1996

d)

SELECT FirstName, LastName FROM Employees, OrderID WHERE Employees.OrderID = Orders.OrderID AND OrderDate Like "%1996%"

5.

Count of how many orders each employee made (see bottom of image)

(a)  

6.

Draw the ER diagram of Employees, Orders and Customers tables

7.

Names of customers who ordered with any employee named Nancy.

4 lines
8.

Add a new employee named "North Zarit", employeeID is 1112, date of birth is 4-1-1991, the pic is meme.png, he got his medical degree from Chula

a)

INSERT INTO Employees (EmployeeID, LastName, FirstName, BirthDate, Photo, Notes) VALUES (1112, "Zarit", "North", "4-1-1991", "meme.png", "Got MED from Chula")

b)

INSERT INTO Employees (EmployeeID, LastName, FirstName, BirthDate, Photo, Notes) VALUES (1112, "North", "Zarit", "4-1-1991", "meme.png", "Got MED from Chula")

c)

INSERT INTO Employees (EmployeeID, LastName, FirstName, BirthDate, Photo, Notes) ("North", "Zarit", "4-1-1991", "meme.png", "Got MED from Chula")

d)

INSERT INTO Employees DATA (1112, "North", "Zarit", "4-1-1991", "meme.png", "Got MED from Chula")

9.

Sack all the staff! Delete the table employees.

(a)  

10.

Employee first name and surname with the most amount of orders (use orderID)

Use Inner Join

(a)  

11.

Change North's name to Gorth

a)

UPDATE Employees set FirstName = "Gorth" WHERE Firstname = "North"

b)

CHANGE Employees set FirstName = "Gorth" FROM Firstname = "North"

c)

SELECT Employees set FirstName = "Gorth" FROM EMPLOYEES WHERE Firstname = "North"

d)

SET Employees FROM FirstName = "Gorth" WHERE Firstname = "North"

12.

Make a table called "Dogs", with fields DogID, DogName, Breed, Size (integer), weight (integer), and colour)

[no spaces before or after brackets]

[don't worry about NOT NULL]

(a)