Sunteți pe pagina 1din 20

Jordane Metenou

Data Fundamentals

IT 214-007

November 15, 2016


EMPLOYEE
CUSTOMER
PK EMP_ID
PK CUS_ID
EMP_NAME
CUS_NAME
EMP_DOB
(0,M) CUS_STREET
EMP_NUMBER (1,1)
help CUS_STATE (1,1)
EMP_STREET
CUS_CITY
EMP_STATE
CUS_COUNTY
EMP_CITY
CUS_ZIPCODE
EMP_COUNTY
CUS_NUMBER
EMP_ZIPCODE
FK EMP_ID

(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

(1,1) include QUANTITY

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

CREATING TABLE FOR CUSTOMER1


CREATING TABLE FOR CUSTOMER1_ORDER
CREATING TABLE FOR ORDER_ITEM

CREATING TABLE FOR PRODUCT_TYPE

CREATING TABLE FOR PRODUCT


ADDING DATA TO EMPLOYEE

ADDING DATA TO CUSTOMER1 TABLE


ADD DATA TO CUSTOMER1_ORDER TABLE
ADDING DATA TO ORDER_ITEM TABLE
ADDING DATA TO PRODUCT_TYPE TABLE
ADDING DATA TO PRODUCT TABLE
4. Query

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.

c. A query that includes a sub-query.


This query lists the products that have not yet been ordered by any customer. The query lists the
product id and the product name.

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

S-ar putea să vă placă și