Documente Academic
Documente Profesional
Documente Cultură
Data Fundamentals
IT 214-007
(1,M)
place
CUSTOMER_ORDER
PK CUS_ORDER_ID
CUS_ORDER_DATE (1,M)
CUS_ORDER_TIME ORDER_ITEM
FK CUS_ID PK ORDER_ITEM_ID
associated FK CUS_ORDER_ID
(1,M) FK PRODUCT_ID
(1,1)
PRODUCT
PK PROD_ID
PROD_NAME link
(1,M)
PROD_PRICE PROD_TYPE
FK PROD_TYPE_ID PK PROD_TYPE_ID
(1,1)
PROD_TYPE_DESCRIPTION
CREATING TABLE FOR EMPLOYEE
a. A query that is based on two tables and includes both an arithmetic and a special operator in
the conditional expression.
This query shows the total price for each order that was placed for orders worth more than $10. The
data shows the customer order id and total price columns.
b. A query that is based on more than two tables and includes both an arithmetic and a special
operator in the conditional expression. Both the arithmetic and the special operator must be different
from the ones used in part a.
This query shows each customers total price when a $1 discount is applied. The query shows the
customers which a discounted price between $3 and $5. The query shows the customer name and
discounted total price.
d. A query that contains the GROUP BY clause, one of the aggregate functions, the WHERE
statement, and the HAVING operator.
This query shows the product that has been ordered twice. The query shows the product name and the
number of times its been part of an order.
e. Two additional complex queries designed by you that are different from the above. A complex
query is based on two or more tables and includes either several conditions or a subquery (or both).
This query shows products that have a price above the average price of all the products. The query
shows the product type description, product name and the product price.
This query shows the most expensive product. The product type description, product name and product
price are all shown in the result