0% found this document useful (0 votes)
66 views

Database Design Cheatsheet

This document provides a cheatsheet for database design. It outlines the key steps which are: 1) identify domain entities, 2) define attributes and primary keys for each entity, and 3) apply normalization techniques like 1NF, 2NF and 3NF to filter out redundancies. Some examples of entities for an online store are customers, products, and reviews with identifying attributes like customer email and product IDs. Relationships between entities like one-to-one, one-to-many and many-to-many are also covered.

Uploaded by

Giovanni Marchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Database Design Cheatsheet

This document provides a cheatsheet for database design. It outlines the key steps which are: 1) identify domain entities, 2) define attributes and primary keys for each entity, and 3) apply normalization techniques like 1NF, 2NF and 3NF to filter out redundancies. Some examples of entities for an online store are customers, products, and reviews with identifying attributes like customer email and product IDs. Relationships between entities like one-to-one, one-to-many and many-to-many are also covered.

Uploaded by

Giovanni Marchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Database Design Cheatsheet

Identify the domain entities. For Define the attributes for each entity. 1NF One-to-one Filter out redundancies.
example, for an online store:
● Customers For example: Atomic values for each attribute. No has
● Products ● Customer’s attributes can be: values like: “‘phoneX, tabletY, laptopZ”
● Reviews email, first_name, last_name, etc. for a ‘favorite_product’ attribute in
● Product attributes: id, name, One Capital
Customers table. One Country
If there is data that doesn’t fit in this description, price City
entities categories, probably it’s an Non Repeating groups: No columns ● Foreign Key can be on each side.
Decide what primary keys to use: (attributes) like: favorite_product1, ● It can be forced using an UNIQUE
attribute.
email for a customer (or assign an favorite_product2, favorite_product3 in constraint.
unique number id), id for a product the Customers table
(which could be the barcode number, One-to-Many / Many-to-one Examine the Database design and if
or an unique auto generated number) Records (rows) are unique. A redundancies are found, remove them.
customer with id = 111, appears only
once in the Customers Table owns
Customers
Customers 2NF
id email first_name last_name
One (Rich) Many Review with Client
Non-key (non prime) attributes are
Person Houses
depended on the whole composite
Products key. Eg: Column ‘price’ in Reviews table
● Foreign Key is on the Houses side
Products breaks 2NF. It is depended only on the
referencing a person’s id
id name description price product_id.
(Houses.person_id)
All tables that have only one attribute
Reviews as primary key are in 2NF by default. Many-to-Many
Reviews customer product rating comme
_id _id nts
3NF
[Every] non-key [attribute] must be Review the specifications with your
depended on the key, the whole key, A customer A product is client to ensure that the database
and nothing but the key. reviews many reviewed by many model supports the data requir­
Adding ‘brand’ and ‘brand_description’ products customers ements.
in Products table breaks 3NF.
‘brand_description’ is depended on ● Use intermediary table that holds
‘brand’, which is not a key. the foreign keys.

1. Define Domain 2. Define Attributes & 3. Apply Normalization 5. Build the tables 6. Polish the
Entities Primary Keys 1FN, 2FN, 3FN relationships design

The Complete Database Design & Modeling Beginners Tutorial (https://goo.gl/nBK357)

You might also like