Font size
WorksheetsReferential and Where
Total questions: 20
Worksheet time: 10mins
In order to modify data in a database we would use which SQL statement?
Update
Amend
Alter
Modify
Referential Integrity is
System of rules
System of data
Table constraints
is related to Primary key
A primary key can be NULL in the table? TRUE or FALSE
TRUE
FALSE
Select DDL commands from among the options...
SELECT
ALTER
DROP
DELETE
The primary key of a table which is present in another table for referencing is known as (a)
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”?
SELECT * FROM Persons WHERE FirstName=’a’
SELECT * FROM Persons WHERE FirstName LIKE ‘a%’
SELECT * FROM Persons WHERE FirstName LIKE ‘%a’
SELECT * FROM Persons WHERE FirstName=’%a%’
What does the ALTER TABLE clause do?
The SQL ALTER TABLE clause modifies a table definition by altering, adding, or deleting table columns and/or constraints
The SQL ALTER TABLE clause is used to insert data into database table
THE SQL ALTER TABLE deletes data from database table
The SQL ALTER TABLE clause is used to delete a database table
How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?
UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
SQL query to find all the cities whose humidity is 95.
SELECT city WHERE humidity = 95
SELECT city FROM weather WHERE humidity = 95
SELECT humidity = 89 FROM weather
SELECT city FROM weather
Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70
The command to remove rows from a table ‘CUSTOMER’ is __________________
DROP FROM CUSTOMER
UPDATE FROM CUSTOMER
REMOVE FROM CUSTOMER
DELETE FROM CUSTOMER WHERE
If you were wanting to filter data, which clause would you use?
Where
Order by
From
Select
Using which word allows you to specify that more than one condition must be met in a query?
Also
And
Or
Where
Using which word allows you to specify that only one of a series of conditions needs to be met in a query filter?
And
Maybe
If
Or
You are required to update the phone number for only the DesignerID "SMI01" in the "Designer" table. Which of these would successfully do that?
UPDATE Designer SET PhoneNo = '01224123456'
UPDATE Designer (PhoneNo) VALUES ('01224123456')
UPDATE Designer SET PhoneNo = '01224123456' WHERE DesignerID = 'SMI01'
UPDATE PhoneNo = '01224123456' FROM Designer WHERE DesignerID = 'SMI01'
How would you DELETE records from the Items table with a "Chair" Type?
DELETE 'Chair' FROM Items
DELETE Type FROM Items WHERE Type = 'Chair'
DELETE FROM Items WHERE Type = 'Chair'
DELETE ITEMS WHERE Type = 'Chair'
How would you display Chairs in the Items table that have a Price greater than £50.
SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50
SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100
SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50
SELECT * FROM Items WHERE Price > 50
A field in one table that is the primary key of another table and establishes a relationship between the two tables
Primary Key
Foreign Key
House Key
Attribute
The table with the primary key is called the referenced or ............ table.
PARENT
CHILD
HYBRID
