Write SQL to raise the price of product 17 to 4.99.
- UPDATE Product
- SET Price = 4.99
- WHERE ProductID = 17
Answer UPDATE Product SET Price = 4.99 WHERE ProductID = 17
A-level Computer Science revision · Exchanging data
INSERT INTO adds records, UPDATE ... SET changes them and DELETE FROM removes them. Nested queries use one SELECT inside another. Referential integrity means a foreign key value must refer to an existing record (or be empty if allowed), so you cannot delete a record that others depend on without handling them.
Watch out UPDATE or DELETE without a WHERE clause changes every record in the table.
Write SQL to raise the price of product 17 to 4.99.
Answer UPDATE Product SET Price = 4.99 WHERE ProductID = 17
What does DELETE FROM Customer do?
What is referential integrity?
Write SQL to add a new student with ID 205, name 'Amy' and year 12.
Answer INSERT INTO Student (StudentID, Name, Year) VALUES (205, 'Amy', 12)
A-level Computer Science Pro, OCR H446
£119 once
Price rises to £199 on 1 January. Save £80 by joining before then.
At least 12 months of access
No VAT is charged.