Q1. Write the SQL code to create the table structures for the entities shown in the above ERD. The structures should contain the attributes specified in the ERD. Use data types that are appropriate for the data that will need to be stored in each attribute. Enforce primary key and foreign key constraints as indicated by the ERD. Q2. Add INSERT INTO statements to populate your database. Include at least 4 representative tuples in each table. Q3. Using the integrity enhancement features of SQL, write the statements that add the following constraints: 1. The Product Price on the PROUCT table must be between 20 and 200 2. No two vendors with the same names in VENDOR table

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

hello, please use the diagram to answer the following questions in database and sql:

 

SALESREP
PK SLSREP_NUM
PK CUST NUM
CUSTOMER
CUST_LNAME
CUST_FNAME
CUST_AREACODE
CUST_PHONE
CUST_E-MAIL
FK2
CUST_SHIP_ADDRESS
CUST_SHIP_CITY
CUST_SHIP_STATE
CUST_ZIP_CODE
INVOICE
PK INV_NUM
SLSREP_LNAME-It writes OFK1 CUST_NUM
FK2 SLSREP_NUM
SLSREP_FNAME
SLSREP INITIAL
INV_DATE
SLSREP_EMAIL
INV_SUBTOTAL
PK,FK1
PK
I
generates
INV_TAX
INV_TOTAL
contains
INV_LINE
INV_NUM
INV LINE NUM
PROD_CODE
INV_LINE_PRICE
INV_LINE_QUANT
INV_LINE_TOTAL
VENDOR
PK VEND_CODE
VEND NAME
VEND_CONTACT
VEND_EMAIL
I
I
supplies
I
PRODUCT
PROD_CODE
PK
0 is written in +1-FK1 VEND_CODE
PROD_DESCRIPTION
PROD_PRICE
PROD_QOH
Transcribed Image Text:SALESREP PK SLSREP_NUM PK CUST NUM CUSTOMER CUST_LNAME CUST_FNAME CUST_AREACODE CUST_PHONE CUST_E-MAIL FK2 CUST_SHIP_ADDRESS CUST_SHIP_CITY CUST_SHIP_STATE CUST_ZIP_CODE INVOICE PK INV_NUM SLSREP_LNAME-It writes OFK1 CUST_NUM FK2 SLSREP_NUM SLSREP_FNAME SLSREP INITIAL INV_DATE SLSREP_EMAIL INV_SUBTOTAL PK,FK1 PK I generates INV_TAX INV_TOTAL contains INV_LINE INV_NUM INV LINE NUM PROD_CODE INV_LINE_PRICE INV_LINE_QUANT INV_LINE_TOTAL VENDOR PK VEND_CODE VEND NAME VEND_CONTACT VEND_EMAIL I I supplies I PRODUCT PROD_CODE PK 0 is written in +1-FK1 VEND_CODE PROD_DESCRIPTION PROD_PRICE PROD_QOH
Assignment_02.pdf - Google Chrome
www-van-ovx.omnivox.ca/cvir/dtrv/ReadDocumentTravail.aspx/Assignment_02.pdf?idtravail=ef9add44-45a8-44ab-b9e1-65379db29092&iddocumenttravail=66cd7470-af... Q
Assignment_02.pdf
1
that will many and
2
Type here to search
O
2/2
87% +
Q1. Write the SQL code to create the table structures for the entities shown in the above ERD.
The structures should contain the attributes specified in the ERD. Use data types that are
appropriate for the data that will need to be stored in each attribute. Enforce primary key and
foreign key constraints as indicated by the ERD.
Q2. Add INSERT INTO statements to populate your database. Include at least 4 representative
tuples in each table.
Q3. Using the integrity enhancement features of SQL, write the statements that add the
following constraints:
1. The Product Price on the PROUCT table must be between 20 and 200
2. No two vendors with the same names in VENDOR table
Q4. The manager wants you to register a new product described as 'Northwoods Cranberry
Sauce' supplied by 'Tokyo Traders' vendor. At the same time, this product will be added to
the new invoice for the customer "Alfreds Futterkiste". What would your statements look
like?
Q5. They also asked you to modify the PRODUCT table by adding 10% to all the prices of 'G
Tokyo Traders 'vendor.
Q6. Now, the manager wants you to delete the 'Northwoods Cranberry Sauce' product from
the database but keep all the related records. Can you delete it? Why/Why not? What would be
your solution?
E:
17°C
(4) ENG
x
7:11 PM
2022-10-05
Transcribed Image Text:Assignment_02.pdf - Google Chrome www-van-ovx.omnivox.ca/cvir/dtrv/ReadDocumentTravail.aspx/Assignment_02.pdf?idtravail=ef9add44-45a8-44ab-b9e1-65379db29092&iddocumenttravail=66cd7470-af... Q Assignment_02.pdf 1 that will many and 2 Type here to search O 2/2 87% + Q1. Write the SQL code to create the table structures for the entities shown in the above ERD. The structures should contain the attributes specified in the ERD. Use data types that are appropriate for the data that will need to be stored in each attribute. Enforce primary key and foreign key constraints as indicated by the ERD. Q2. Add INSERT INTO statements to populate your database. Include at least 4 representative tuples in each table. Q3. Using the integrity enhancement features of SQL, write the statements that add the following constraints: 1. The Product Price on the PROUCT table must be between 20 and 200 2. No two vendors with the same names in VENDOR table Q4. The manager wants you to register a new product described as 'Northwoods Cranberry Sauce' supplied by 'Tokyo Traders' vendor. At the same time, this product will be added to the new invoice for the customer "Alfreds Futterkiste". What would your statements look like? Q5. They also asked you to modify the PRODUCT table by adding 10% to all the prices of 'G Tokyo Traders 'vendor. Q6. Now, the manager wants you to delete the 'Northwoods Cranberry Sauce' product from the database but keep all the related records. Can you delete it? Why/Why not? What would be your solution? E: 17°C (4) ENG x 7:11 PM 2022-10-05
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
SQL Query
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education