Define main key and foreign key represent graphically the


1) Consider a Product Orders Database: create tables, connections between tables and fill it with data for tests. Then create SQL querys for the following points:

a) supplyer (supplyer_id->name, address, postal code, phone number, e-mail)
b) product (product_id->name, price, unit)
c) order (order_id->data, supplyer_id, deadline, satisfaction )
d) order_line (order_id, line->product_id, quantity)

1.1) Define main key and foreign key. Represent graphically the relational data base, with its tables and connections of foreign keys. Follow this rule: 1:N connections is represented table with just one line above and table with multiple lines below.
Next, write, in SQL, the following querys:

1.2) What products in Kg units?
1.3) What is the product with more orders?
1.4) What suppliers have sold more than 10000 euros?
1.5) Select all products with price less than 20 and unit Kg or liter
1.6) List names and respective prices of products with price greater than the mean of all the other products price
1.7 List all data of suppliers that owed money in the 1st semester of 2011 and do not owed money in the second semester.

2) Using the same database refered above, consult https://www.w3schools.com/SQl/default.asp and answer the following questions:

2.a) Give an example of Left Junction;
2.b) Give an example of Right Junction;
2.c) Give an example of Cartesian Product.

 

Solution Preview :

Prepared by a verified Expert
Database Management System: Define main key and foreign key represent graphically the
Reference No:- TGS0666030

Now Priced at $40 (50% Discount)

Recommended (98%)

Rated (4.3/5)