Video summary
พื้นฐานการออกแบบฐานข้อมูล | Database Design 101 😎💯
Main summary
Key takeaways
Main ideas / lessons (Database Design 101)
- Database design starts from system needs
- Perform requirement analysis: determine what data the system must store.
- Think in terms of entities (things to store) before tables/columns.
Step-by-step workflow (core methodology)
- Analyze system requirements
- Identify what data must be collected.
- Example used throughout: an online bookstore needs customers, books, orders, etc.
- Define entities and their attributes
- Entity → table
- Attribute → field/column
- Example attributes:
- Customer:
customer ID,name,email address - Book:
book ID,title,author,price - Order:
order ID,order date
- Customer:
- Define Primary Keys (PKs):
customer IDis PK for Customer tablebook IDis PK for Book tableorder IDis PK for Orders table
- Draw an ER diagram
- Use ER diagrams to visualize the structure and relationships between tables.
- Tool mentioned: draw.io
- Define table structures (logical design → relational tables)
- Convert ER diagram into table definitions.
- Include primary keys and foreign keys.
- Normalize to prevent problems (data duplication / redundancy)
- Normalization targets:
- Avoid repeated/duplicated data (e.g., don’t store book titles directly inside the order table).
- Reduce complexity and improve correctness.
- Improve flexibility for future changes.
- Normalization targets:
- Implement using SQL
- Create tables and constraints in SQL so the design can be used in real systems.
Table relationships: the 3 main types (with rules)
1) One-to-One (1:1)
- Meaning: one row in Table A relates to only one row in Table B.
- Use case: separating detailed/important info.
- Example: a customer has one profile entry.
2) One-to-Many (1:N) — most common
- Meaning: one row in Table A can relate to multiple rows in Table B.
- Mechanism: Table B includes a foreign key referencing Table A’s primary key.
- Example: one customer can place multiple orders.
3) Many-to-Many (N:M)
- Meaning: multiple rows in Table A relate to multiple rows in Table B.
- Key rule: requires a central “junction/bridge” table (also called an associative entity).
- Example in the bookstore:
- One order can contain multiple books.
- One book can appear in multiple orders.
- Junction table example:
order_detail- Stores combinations of:
order ID(FK to Orders)book ID(FK to Books)
- Also includes additional attributes like:
quantity
- Stores combinations of:
- Example in the bookstore:
Why the junction table is necessary (explicit points)
- Support multiple items per order
- Without a junction table, each row might only represent a single item; you need multiple rows to represent multiple books in one order.
- Prevent duplicate data
- Avoid storing repeated lists like
Book1ID, Book2ID, Book3ID...in the order table. - This addresses normalization principles.
- Avoid storing repeated lists like
- Store extra order-specific details per item
- Example:
quantityper book within a specific order. - Future additions (e.g., per-book discounts at purchase time).
- Example:
- Enable future expansion without major table restructuring
- E.g., promotions tied to certain books can be handled by extending data in the design (including the junction table as needed).
Keys: Primary Key and Foreign Key
Primary Key (PK)
- A column or set of columns that uniquely identifies each row.
- Must be unique and not empty.
- Example:
customer IDuniquely identifies a customer.
Foreign Key (FK)
- A column used to link one table to another.
- References the primary key of the related table.
- Example:
orders.customer IDis an FK pointing tocustomer.customer IDto indicate the order belongs to a customer.
Normalization basics (as taught: 1NF, 2NF, 3NF)
- 1NF (First Normal Form)
- Data must be atomic:
- Do not store multiple values in a single field.
- Data must be atomic:
- 2NF (Second Normal Form)
- Non-key data must depend entirely on the primary key.
- 3NF (Third Normal Form)
- Non-key data must not depend on other non-key fields—dependency should be only on the primary key.
Overall goal emphasized:
- Reduce redundancy
- Prevent unnecessary duplication
- Improve maintainability/clarity
Final “basic principles” recap (as a checklist)
- Start with requirements (what the system must store)
- Define entities/tables for the main objects (e.g., Customer, Book, Order)
- Add attributes/columns and relationships
- Draw an ER diagram to visualize structure and relationships
- Convert to tables, defining PKs and FKs
- Normalize to avoid duplicate/redundant data
- Create the real database using SQL
Speakers / sources featured
- Speaker: The YouTube presenter (unnamed in the subtitles)
- Tools / sources mentioned:
- draw.io
- SQL (Structured Query Language)
- Promotional/source mentions (membership/service):
- “Jan Ohm” / “Janom” (mentioned as the creator/brand in the closing)
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.