Having a very simple table shema:
order_id (pk), customer_id(fk), order_date, ship_date, ship_address
Is such a table in 2NF? If so is it also in 3NF?
Thx for help:-)
Having a very simple table shema:
order_id (pk), customer_id(fk), order_date, ship_date, ship_address
Is such a table in 2NF? If so is it also in 3NF?
Thx for help:-)
I think it's the 2NF, because there could be one more useful table.
3NF should look like:
# orders
order_id (pk)
customer_id (fk)
ship_address_id (fk)
order_date
ship_date
# customers
customer_id (PK)
customer_field1
...
# addresses
address_id (PK)
customer_id (FK)
street
zip
...
Amazon allows to add several addresses (home, office, ...). You should do it as well! :-)
your order table should be split into orderDetails with a sibling of a product table and ShipDetails. The order table should only have attributes that pertain to the order like total quanty of products for order or order date. the orderDetail will have productID and quantity of each.
The rule of thumb is "the key, the whole key and nothing but the key"