Assignment # 5 SQL

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Assignment # 5

1) The output will list the number and name of all customers represented by sales 35 or that

currently have orders on file or both.

2) The output will list the description of all parts that are located in warehouse 3 or which there

are more than 20 units of hand or both.

3) The output will list the customer number, Name, Street, and city zip for all customers whose

street contains the pattern ‘Oxford’.

4) Based on the code above, list the number, name, street and credit limit of all customers.

Order the customers by name within the descending credit limit.

5) Output will list num name limit, and repnum of customers whose rep- num 35 and also credit

should exceed 2000, with both conditions should satisfy.

6) Output will list the number, name, limit and rep num of all customers if either the customer

rep num is 35 or if his credit limit should exceed 3000.

7) Output will list the number name of all the customers whose rep rum is equal to rename in

the rep table; the last name should be Perez, and his first name should be JUAN.

Step 1: Answer in Question

8) According to the E-R Diagram, the database has five tables: Rep, Customer, Orders, Order

Line, and Part. The following is the connection between these tables:

a) The relationship between the table rep and the table customer is as follows: Rep Selles

Products to Customer. Because one Rep may offer items to several consumers, the connection

between Rep and Customer is one-to-many.


b) Customer Places Orders is the relationship between table customers and table orders. Because

a single Customer may make several Orders, the connection between Customer and Orders is

one too many.

c) The following is the relationship between Table Orders and Table OrderLine: Orders are made

up of OrderLine. Because one Order might include several OrderLine, the connection between

Orders and OrderLine is one to many.

d) The following is the relationship between Table OrderLine and Table Part: OrderLine

Belongs to Part. The Component table includes information about the OrderLine, such as the

description and warehouse where the order part is held. Because one Part might include several

OrderLines, the connection between OrderLine and Part is one to many.

Step 2: In Conclusion

According to the E-R Diagram, the database has five tables: Rep, Customer, Orders, OrderLine,

and Part. The following is the connection between these tables:

a) The relationship between the table rep and the table customer is as follows: Rep Selles

Products to Customer. Because one Rep may offer items to several consumers, the connection

between Rep and Customer is one-to-many.

b) Customer Places Orders is the relationship between table customers and table orders. Because

a single Customer may make several Orders, the connection between the Customer and Orders is

one to many.
c) The following is the relationship between Table Orders and Table OrderLine: Orders are made

up of OrderLine. Because one Order might include several OrderLine, the connection between

Orders and OrderLine is one too many.

d) The following is the relationship between Table OrderLine and Table Part: OrderLine Belongs

to Part. The Component table includes information about the OrderLine, such as the description

and warehouse where the order part is held. Because one Part might include several OrderLines,

the connection between OrderLine and Part is one to many.

You might also like