- Concepts
- Gather all of the types of information you might want to record in the database, such as product name and order number.
- Concepts
- Divide your information items into major entities or subjects, such as Products or Orders. Each subject then becomes a table.
- Concepts
- Decide what information you want to store in each table. Each item becomes a field, and is displayed as a column in the table.
- Concepts
- Choose each table’s primary key. The primary key is a column that is used to uniquely identify each row.
- Concepts
- Look at each table and decide how the data in one table is related to the data in other tables. Add fields to tables or create new tables to clarify the relationships, as necessary.
- Types of relationship
- One-to-one (1:1)
- Each record (or row) in one table is related to exactly one record in another table, and vice versa.
- One-to-many (1:N)
- Each record in one table can be related to multiple records in another table, but each record in the second table is related to only one record in the first table.
- Many-to-many (N:M)
- One-to-one (1:1)
- Concepts
- Look at each table and decide which column need to be indexed based on the common queries will be run from the applications.
- Which column needs to be indexed
- Concept
- Each column must have only one value, it cannot hold multiple values.
- Example
- Violation (The
Department
column)EmployeeID EmployeeName Department 001 John Sales,Finance 002 Mary Sales,Finance,HR
- Violation (The
- Concept
- Satisfies 1NF.
- Each non-key column (a column that is not part of the primary key) should be functionally dependent on the entire primary key.
- Example
- Violation (ProductName depends on the ProductID only, not the entire composite key)
OrderID (PK) ProductID (PK) ProductName 001 003 Fork 001 005 Bowl
- Violation (ProductName depends on the ProductID only, not the entire composite key)
- Concept
- Satisfies 2NF.
- Non-key columns should not depend on other non-key columns.
- Example
- Violation (ManageName depends on EmployeeName)
EmployeeID EmployeeName ManagerName 001 John Alex 002 Mary Mike
- Violation (ManageName depends on EmployeeName)
-
Concept
-
Pros
- Improves read performance
- Simplifies queries
- Reduces complexity
-
Cons
- Increases redundancy
- Increases storage usage
- Degrades write performance
- Increases maintenance complexity