WorksheetsSQL Programming
Total questions: 10
Worksheet time: 8mins
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)
Select all records where the value of the City column starts with the letter "a".
SELECT * FROM Customers
(a) ;
Select all records where the City column has the value "Berlin"
SELECT * FROM Customers
ــــــــــــــــ City = "Berlin";
INSERT
SELECT
DROP
WHERE
Select all records from the Customers table, sort the result alphabetically by the column City
SELECT * FROM Customers
ــــــــــــــــ City;
(a)
Select all the different values from the Country column in the Customers table
SELECT ـــــــــــــــــــــ Country FROM Customers;
DISTICNT
DISTINCT
DITSINCT
DISTINTC
Select all records from the Customers where the PostalCode column is empty
SELECT * FROM Customers
WHERE PostalCode ــــــــــــــــــــــــــ ;
IS EMPTY
IS NULL
NOT FILLED
Update the City column of all records in the Customers table
ــــــــــــــــــ Customers
ــــــــــ City = "Oslo"
UPDATE / MAKE
UPGRADE / SET
SET / UPDATE
UPDATE / SET
Delete all the records from the Customers table where the Country value is 'Norway'
ـــــــــــــــــــــ Customers
WHERE Country = 'Norway';
(a)
Write the correct SQL statement to create a new database called testDB
ــــــــــــــــــــــــــــــــــــــــــــــــــ ;
(a)
Add a column of type DATE called Birthday
ALTER TABLE Persons
ــــــــــــــــــــــــــــــ ;
(a)
