Updating and Deleting Records - Exercise

Contact Us or call 1-877-932-8228
Updating and Deleting Records - Exercise

Updating and Deleting Records

Duration: 5 to 15 minutes.

In this exercise, you will practice updating and deleting records.

  1. Update your record in the Employees table to include some Notes.
  2. Raise the unit price of all products in the Products table by 10% for all products that are out of stock. This should affect 5 rows.
  3. Try to delete yourself from the Employees table. Could you?
  4. If you were not allowed to delete yourself from the Employees table, figure out what other records you have to delete so that you can.

Solution:

InsertsUpdatesDeletes/Solutions/UpdateDelete.sql
UPDATE Employees
SET Notes = 'Nat does not really work here.'
WHERE FirstName = 'Nathaniel' AND LastName = 'Dunn';

UPDATE Products
SET UnitPrice = UnitPrice * 1.1
WHERE UnitsInStock = 0;

DELETE FROM "Order Details"
WHERE OrderID = 11078;
-- Note that your OrderID might be different

DELETE FROM Orders
WHERE OrderID = 11078;
-- Note that your OrderID might be different

DELETE FROM Employees
WHERE FirstName = 'Nathaniel' AND LastName = 'Dunn';