Question

We will use a simple database composed of the following tables: CUSTOMER, INVOICE, LINE, PRODUCT, and VENDOR.

This database model is shown in Figure 1. The database model in Figure 1 reflects the following business rules: - A customer may generate many invoices. Each invoice is generated by one customer. - An invoice contains one or more invoice lines. Each invoice line is associated with one invoice. - Each invoice line references one product. A product may be found in many invoice lines. (You can sell more than one hammer to more than one customer!) - A vendor may supply many products. Some vendors do not (yet?) supply products. (For example, a vendor list may include potential vendors.) - If a product is vendor-supplied, that product is supplied by only a single vendor. - Some products are not supplied by a vendor. (For example, some products may be produced “inhouse” or may have been bought on the open market.)

INVOICE LINE CUSTOMER CUSCODE CUS FNAME CUS AREACODE CUS BALANCE INY NUMBER CUS CODE IV DATE LINE NMEER o P DESCRIPT P ONHAND P MIN VENDOR P DISCOUNT CODE V_AREACODE ORDER Figure 1- The database model CUS 10010 Ramas 0013 olowski 10015 OBrian 10018 Farriss Table name: CUSTOMER 54778-2 1 2238 PD 2 1546-Q02 3 13-02P2 1 54778-2 CUS CODE NV_DATE 10014 16-Jan-04 10011 16-Jen-04 10012 16-Jon-04 1001117 Jan-04 0018 17-Jen-04 10014 17-Jan-04 10015 17-Jen-04 10011 17-Jon-04 1006 1007 1008 1 PVC23DRT Table name: INVOICE Table name: LINE

2A) Write the SQL code to discard the change you have made to the table CUSTOMER_1 in the question 5.

2B) Write the SQL code to delete the row for customer named Kathy Smith, whose phone number is 894- 2285. (Hint: Use logical operators to include all the information given in this problem.)

2C) Write the SQL code that will restore the data to its original status; that is, the table CUSTOMER_1 should contain the data that existed before you made the changes in Questions 7.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer)
2A) Write the SQL code to discard the change you have made to the table CUSTOMER_1 in question 5.

The changes made in question 5 are not clear. Please share those.

2B) Write the SQL code to delete the row for the customer named Kathy Smith, whose phone number is 894- 2285.

DELETE FROM customer
WHERE CUS_FNAME='Kathy' and CUS_LNAME='Smith'
and CUS_PHONE='894-2285';

2C) Write the SQL code that will restore the data to its original status; that is, the table CUSTOMER_1 should contain the data that existed before you made the changes in Questions 7.

The changes made in Questions 7 are not clear.

Please share.


For your information, we can use the command:
rollback;
to rollback and undo the changes to restore the data to its original status.

Add a comment
Know the answer?
Add Answer to:
We will use a simple database composed of the following tables: CUSTOMER, INVOICE, LINE, PRODUCT, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the ch08_saleco database write a T-SQL query to display the customer code, invoice number invoice...

    Using the ch08_saleco database write a T-SQL query to display the customer code, invoice number invoice date, and invoice subtotal from invoice conditioned on the invoice subtotal is greater than $100 and from only customer codes 10011 and 10012. (hint: in) /* Database Systems, 8th Ed., Rob/Coronel */ /* Type of SQL : SQL Server */ CREATE TABLE CUSTOMER ( CUS_CODE int, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT...

  • Answer all questions on paper: Consider the database model below The database model FIGURE 7.1 CUSTOMER...

    Answer all questions on paper: Consider the database model below The database model FIGURE 7.1 CUSTOMER INVOICE LINE PK CUS CODE INV NUMBER FK1 CUS_COOE NV DATE CUS LNAME CUS FNAME CUS INITIAL CUS AREACODE CUS PHONE CUS BALANCE LINE UNITS LINEPRICE - isfound in VENDOR PRODUCT V NAME supplies P INDATE P DESCRIPT CONTACT de- V AREACODE V PHONE V STATE V ORDER ?,.QOH P MIN P PRICE Write the SQL code for creating the database and all the...

  • CUSTOMER EMP INVOICE LINE P CODE V CODE CUS CODE EMP CODE NV NUMBER NV NUMBER,...

    CUSTOMER EMP INVOICE LINE P CODE V CODE CUS CODE EMP CODE NV NUMBER NV NUMBER, LINE NUMBER Create SQL queries for displaying the following results 5. List the customers who have ordered product bearing product code "23109-HB. Display first names, last names of customers, invoice numbers and product codes 6. Display Vendor details (V_CODE, V NAME) and product details (P CODE, P DESCRIPT) and product quantity on hand in excess of product min quantity (give alias of Quantity above...

  • Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL...

    Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX /* Database Systems, Coronel/Morris */ /* Type of SQL : SQL Server */ /* WARNING: */ /* WE HIGHLY RECOMEND...

  • Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB...

    Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB4DB; USE LAB4DB; CREATE TABLE CUSTOMER ( CUS_CODE int primary key, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT INTO CUSTOMER VALUES('10011','Dunne','Leona','K','713','894-1238','0'); INSERT INTO CUSTOMER VALUES('10012','Smith','Kathy','W','615','894-2285','345.86'); INSERT INTO CUSTOMER VALUES('10013','Olowski','Paul','F','615','894-2180','536.75'); INSERT INTO CUSTOMER VALUES('10014','Orlando','Myron','','615','222-1672','0'); INSERT INTO CUSTOMER VALUES('10015','O''Brian','Amy','B','713','442-3381','0'); INSERT INTO CUSTOMER VALUES('10016','Brown','James','G','615','297-1228','221.19'); INSERT INTO CUSTOMER VALUES('10017','Williams','George','','615','290-2556','768.93'); INSERT INTO CUSTOMER VALUES('10018','Farriss','Anne','G','713','382-7185','216.55'); INSERT INTO CUSTOMER VALUES('10019','Smith','Olette','K','615','297-3809','0'); /*...

  • Question 1. For each table, identify the primary key and the foreign key(s). If a table...

    Question 1. For each table, identify the primary key and the foreign key(s). If a table does not have a foreign key, write None. Question 2. Do the tables exhibit entity integrity? Answer yes or no, and then explain your answer. Question 3. Do the tables exhibit referential integrity? Answer yes or no, and then explain your answer. Write NA (Not Applicable) if the table does not have a foreign key. Question 4. Describe the type(s) of relationship(s) between CUSTOMER...

  • 2. Find the maximum QOH of all products. it generates INVOICE PK IN NUMBER FK1CuS_CODE INV_DATE...

    2. Find the maximum QOH of all products. it generates INVOICE PK IN NUMBER FK1CuS_CODE INV_DATE contains CUSTOMER PK CUS_CODE CUS_LNAME CUS FNAME CUS INITIAL CUS AREACODE CUS PHONE CUS_BALANCE + LINE PKFK1 INV_NUMBER +PX LINE NUMBER FK2 P CODE LINE_UNITS LINE_PRICE is found in VENDOR PKY_CODE V_NAME CONTACT HF - Supplies PRODUCT PK ecoot P_DESCRIPT P_INDATE P QOH P_MIN P PRICE P_DISCOUNT FK1V_CODE V_AREACODE V_PHONE V_STATE V_ORDER

  • Hi this is for SQL Use the AP database Vendor name from the vendor table Vendor...

    Hi this is for SQL Use the AP database Vendor name from the vendor table Vendor Contact First Name and Vendor Contact Last Name from the vendor table but I need them concatenated together with a space between the names Invoice Date from the invoice table Only the day of from the Invoice Date Invoice Number from the invoice table The third and fourth characters from the Invoice Number Line Item Amount from the invoice line items table Calculate the...

  • * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following...

    * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following tables: VENDOR, PRODUCT, CUSTOMER, INVOICE, LINE EMPLOYEE and loads the default data rows */ set echo on; set serveroutput on; select systimestamp from dual; show user; ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'; DROP TABLE LINE CASCADE CONSTRAINTS; DROP TABLE INVOICE CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE VENDOR CASCADE CONSTRAINTS; DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE...

  • Please highlight was is needed. I have completed # 2, 6, and I beleive 7. Everything...

    Please highlight was is needed. I have completed # 2, 6, and I beleive 7. Everything related to show 7 needs to be highlighted purple which was everything with capital letters needs to be highlighted purple which I have done. The yellow highlight shows all the empty lines which are highlighted already as well. If I could get the rest done that would be great. 1. All SQL scripts should be written to execute in a SQL Server 2016 database....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT