Goal use a transaction to add new rows to two tables at the


Structured Query Language

Goal: Use a transaction to add new rows to two tables at the same time. You must add a row into one table first, before the row can be added into the second table.

Using the class example database (SQLFUN), create the required SQL statements to produce the following results:

Add a new food to the L_foods table from a new supplier.Add Fresh Salmon as menu item 11.

  • The supplier_id is CFF.
  • The product_code is SA.
  • The price is $8.25.
  • There is no price_increase value.

Step 1: Add CFF to the L_suppliers table. (The name of this supplier is Cathy's Fresh Fish).

Step 2: In Oracle or mySQL, make these two inserts in a single transaction:

You first need to add the row to the L_suppliers table because I have created a rule that says, "When a new row is added to the L_foods table, the supplier_id must already exist in the L_suppliers table."

Do a rollback after you have inserted both rows and viewed your changes.

Goal: Using SQL, create a new table. Define each of its columns. Include at least one text and one numeric column.

Create a table using SQL:Build a table of your favorite songs. Include the following:

  • A song ID
  • Name of the song
  • The performer

You may include other columns if you wish.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Goal use a transaction to add new rows to two tables at the
Reference No:- TGS01586683

Now Priced at $30 (50% Discount)

Recommended (91%)

Rated (4.3/5)