60 likes | 130 Views
Database Management. Week 2. An entity becomes a table. Tables follow these rules: Single value for each cell Each column has distinct name (attribute name) All values in the column are values of the same attribute The order of columns is irrelevant Each row is unique
E N D
Database Management Week 2
An entity becomes a table • Tables follow these rules: • Single value for each cell • Each column has distinct name (attribute name) • All values in the column are values of the same attribute • The order of columns is irrelevant • Each row is unique • The order of rows is irrelevant
Shorthand structure Rep (RepNum, LastName, FirstName, Street, City, State, Zip,…) Customer (CustomerNum, CustomerName, Street, City, State, Zip,…) Orders (OrderNum, OrderDate, CustomerNum) OrderLine (OrderNum, PartNum, NumOrdered, QuotedPrice) Part (PartNum, Description, OnHand, Class, Warehouse, Price) Qualifying the table names: Rep.RepNum, or OrderLine.OrderNum Primary Key The column or collection of columns that uniquely identifies a given row in the table.
Why are there 2 primary keys for OrderLine? • No single column uniquely identifies a given row in the OrderLine table. It requires a combination of two columns: OrderNum and PartNum.