Lab 6 SQL Insert Update Delete 1
Lab 6 SQL Insert Update Delete 1
LABORATORY MANUAL
BCS 306 - Database Management Systems
Spring 2024
Lab 6
Syntax:
The below is generic syntax of SQL INSERT INTO command to insert a
single record in MySQL table:
The UPDATE statement is used with the SET and WHERE clauses. The SET
clause is used to change the values of the specified column. We can update
single or multiple columns at a time.
Syntax
Following is a generic syntax of UPDATE command to modify data into
the MySQL table:
1. UPDATE table_name
2. SET column_name1 = new-value1,
3. column_name2=new-value2, ...
4. [WHERE Clause]
Once we delete the records using this query, we cannot recover it.
Therefore before deleting any records from the table, it is recommended
to create a backup of your database. The database backups allow us to
restore the data whenever we need it in the future.
Syntax:
The following are the syntax that illustrates how to use the DELETE
statement:
EVIDENCE #1
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
EVIDENCE #2
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
5.3. add a new order item for an existing order in “order_items” table:
Order ID: 1
Product ID: 3
Quantity: 5
Unit price: $15.99
EVIDENCE #3
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
5.4. Update the quantity in stock for the product with ID 2 to be 30 in table “products”.
EVIDENCE #4
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
5.5. Update the points for all customers by 10 in the "customers" table of the sql_store
database.
EVIDENCE #5
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
5.6. Update the points of all customers whose birthdate is prior to the year 1990 by adding
100 points to each eligible customer.
EVIDENCE #6
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
5.7. Update the shipment date to be ‘2023-10-02' for an existing order in the "orders" table
of the sql_store database. Choose any order id you want
EVIDENCE #7
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
5.8. Delete a customer with the last name "Betchley" from the "customers" table in the
sql_store database.
EVIDENCE #8
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
5.9. Delete a shipper with id 5 from the "shippers" table in the sql_store database,
ensuring that no orders reference this shipper.
EVIDENCE #9
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.
5.10. Delete a product with id 10 from the "products" table in the sql_store database,
ensuring that all related order items are automatically deleted.
EVIDENCE #10
TAKE A SCREENSHOT OF THE CALL TO THE SCRIPT AND THE OUTPUT OF
THE SCRIPT.