Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are writing commnad statements based on the table shown below, as well as ot

ID: 3656582 • Letter: Y

Question

You are writing commnad statements based on the table shown below, as well as other tables in the General Hardware Company database. Use standard SQL syntax for the commands unless otherwise specified.

(d)PRODUCT table

PRODNUMPRODNAME UNITPRICE

16386 Wrench 12.95

19440 Hammer 17.50

21765 Drill 32.99

24013 Saw 26.25

26722 Pilers 11.50

1. Assuming the table is a partial list of teh table contents, what would you run to delete all hammers from the table?

(d)PRODUCT table

PRODNUMPRODNAME UNITPRICE

16386 Wrench 12.95

19440 Hammer 17.50

21765 Drill 32.99

24013 Saw 26.25

26722 Pilers 11.50


Explanation / Answer

The DELETE statement is used to delete records in a table.

The DELETE statement is used to delete rows in a table.

Note: Notice the WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!

The "Persons" table:

Now we want to delete the person "Tjessem, Jakob" in the "Persons" table.

We use the following SQL statement:

The "Persons" table will now look like this:

It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact:

Note: Be very careful when deleting records. You cannot undo this statement!

P_Id LastName FirstName Address City 1 Hansen Ola Timoteivn 10 Sandnes 2 Svendson Tove Borgvn 23 Sandnes 3 Pettersen Kari Storgt 20 Stavanger 4 Nilsen Johan Bakken 2 Stavanger 5 Tjessem Jakob Nissestien 67 Sandnes
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote