Chapter 9 - Data Design
🗄️ Chapter 9 — Data Design Cheat Sheet
DES329 System Analysis & Design | Final Exam Prep
🧱 Data Design Concepts
Data Structure
A framework for organizing, storing, and managing data — made up of files or tables that interact with each other.
Each file/table stores data about: people, places, things, or events.
File-Oriented vs. Relational Model
| File-Oriented (Mario's Shop) | Relational Model (Danica's Shop) | |
|---|---|---|
| Structure | Separate files per system | Tables linked by a common field |
| Problem | Data entered twice in different files | Enter once, link everywhere |
| Result | Data redundancy — inefficient, error-prone | No duplication, consistent data |
📸 Include Mario vs Danica diagram (Figure in textbook) here
🍎 Analogy: Mario = two separate notebooks where you rewrite the mechanic's name every time. Danica = one shared database with a single
Mechanic Nothat links everything together.
Why relational over file-oriented? → Eliminates redundancy, ensures consistency, allows one data change to propagate everywhere automatically.
Database Management System (DBMS)
A collection of tools, features, and interfaces that enables users to add, update, manage, access, and analyze data.
Advantages:
- Scalability
- Economy of scale
- Enterprise-wide application support
- Stronger standards and better security
- Data independence — changing physical storage doesn't affect how users see data
🍎 Analogy: DBMS = Google Drive for an organization. Everyone accesses the same data without emailing files back and forth.
One database, many systems: A single sales database can simultaneously support Inventory, Accounting, Order, and Production systems.
🔧 DBMS Components
Interfaces
| User Type | Role |
|---|---|
| Users | Work with predefined queries and switchboard commands |
| Database Administrators (DBAs) | Responsible for DBMS management and support |
| Related IS | Other information systems that use the DBMS |
Schema vs. Subschema
| Term | Definition |
|---|---|
| Schema | Description of all fields, tables, and relationships in the database — the full map |
| Subschema | The portion of the database that a particular system or user is allowed to access |
🍎 Analogy: Schema = the full floor plan of a warehouse. Subschema = the specific zone each employee has a keycard for.
Physical Data Repository
- Contains schema and subschemas
- Can be centralized (one location) or distributed (multiple locations)
- Uses ODBC (Open Database Connectivity) compliant software to communicate
🌐 Web-Based Design
Databases for web are created using languages independent of HTML.
Goal: Connect the database to the web for viewing and updating data.
Middleware = the bridge that integrates the web server and database server, and translates data into HTML.
Web Request Flow (4 Steps)
📸 Include Figure 9-9 (Web Request Flow) from textbook here
1. Client workstation → requests a web page → Web Server
2. Web Server → uses middleware → sends query → Database Server
3. Database Server → responds with data → Middleware
4. Middleware → translates to HTML → Web Server → sends page to Client's browser
🍎 Analogy: Like ordering food at a restaurant. You (client) tell the waiter (web server). Waiter tells the kitchen (database). Kitchen sends food back. Waiter serves it to you.
Key concern: Web-based data must be secure yet accessible to authorized users.
📖 Data Design Terminology
Basic Terms
| Term | Definition |
|---|---|
| Entity | A person, place, thing, or event for which data is collected |
| Table / File | Contains a set of related records about a specific entity |
| Field (Attribute) | A single characteristic or fact about an entity |
| Common Field | An attribute that appears in more than one table (used to link them) |
| Record (Tuple) | A set of related fields describing one instance of an entity |
Key Fields
| Key Type | Definition |
|---|---|
| Primary Key | Field(s) that uniquely and minimally identify a record — no two records have the same value |
| Candidate Key | A field that could serve as a primary key (there may be several candidates) |
| Foreign Key | A field in one table that must match a primary key in another table — establishes a relationship |
| Secondary Key | Field(s) used to access/retrieve records (not necessarily unique) |
Primary vs Foreign Key: Primary key = the ID of a record in its own table. Foreign key = a copy of someone else's primary key in your table, used to link the two.
e.g.,
Studenttable hasstudent_id(PK).Registrationtable hasstudent_idas a FK — pointing back to the Student table.
Primary vs Candidate Key: There might be multiple fields that could uniquely identify a record (e.g., student_id, national_id, email). Each of those is a candidate key. You pick one to be the primary key. The rest are just candidates.
Referential Integrity
A set of rules that avoids data inconsistency — ensures a foreign key value always refers to an existing primary key in the related table.
🍎 If a
JOBrecord referencesMechanic No = 99but no mechanic with ID 99 exists — that's a referential integrity violation.
📊 Entity-Relationship Diagrams (ERDs)
A graphic representation of all entities in a system and the relationships between them.
Drawing an ERD
- Entities → rectangles, labeled with singular nouns
- Relationships → diamonds, labeled with verbs
- Read as plain English: "A DOCTOR treats a PATIENT"
Three Types of Relationships
One-to-One (1:1)
Exactly one instance of entity A relates to exactly one instance of entity B.
Examples:
- OFFICE MANAGER heads OFFICE
- SOCIAL SECURITY NUMBER assigned to PERSON
- VEHICLE ID assigned to VEHICLE
📸 Include 1:1 ERD diagram from textbook here
One-to-Many (1:M)
One instance of A relates to many instances of B, but each B relates to only one A.
Examples:
- DEPARTMENT employs EMPLOYEE
- CUSTOMER places ORDER
- FACULTY ADVISOR advises STUDENT
📸 Include 1:M ERD diagram from textbook here
🍎 One teacher (1) teaches many students (M) — but each student has only one advisor.
Many-to-Many (M:N)
One instance of A relates to many instances of B, and vice versa.
Must be resolved using an associative entity (a junction/bridge table).
Examples:
| M:N Relationship | Associative Entity Created |
|---|---|
| STUDENT enrolls in CLASS | REGISTRATION |
| PASSENGER reserves seat on FLIGHT | RESERVATION |
| ORDER lists PRODUCT | ORDER LINE |
📸 Include M:N ERD diagram from textbook here
Why does M:N need an associative entity? You can't store "many" values in a single cell. The bridge table breaks the relationship into two 1:M relationships — one from each side into the middle table.
Cardinality (Crow's Foot Notation)
Describes the numeric relationship between entities — how many of one can relate to how many of another.
| Symbol | Meaning | UML Equivalent |
|---|---|---|
‖ | One and only one | 1 |
‖> (bar + crow's foot) | One or many | 1..* |
○> (circle + crow's foot) | Zero, one, or many | 0..* |
○‖ (circle + bar) | Zero or one | 0..1 |
📸 Include cardinality symbols diagram from textbook here 📸 Include Figure 9-18 (cardinality examples) from textbook here
Cardinality Examples (READ BOTH DIRECTIONS — exam likely!)
| Relationship | Reading |
|---|---|
CUSTOMER ‖ PLACES ○> ORDER | One and only one CUSTOMER places zero to many ORDERs |
ORDER ‖ INCLUDES ‖> ITEM ORDERED | One and only one ORDER includes one or many ITEMS ORDERED |
EMPLOYEE ‖ HAS ○‖ SPOUSE | One and only one EMPLOYEE has zero or one SPOUSE |
EMPLOYEE ○> ASSIGNED TO ○> PROJECT | Zero/one/many EMPLOYEEs assigned to zero/one/many PROJECTs |
📸 Include Figure 9-19 (Library ERD with crow's foot notation) from textbook here
How to read crow's foot notation: Read the symbol closest to the entity to get the min/max on that side. Circle = "could be zero" (optional). Bar = "at least one" (mandatory). Crow's foot = "could be many."
📐 Data Normalization
Creating table designs by assigning specific fields to each table to eliminate redundancy and anomalies.
Standard notation: \boxed{\text{TABLE_NAME}(\underline{\text{PrimaryKey}},\ \text{Field2},\ \text{Field3},\ \ldots)} Primary key field(s) are underlined.
Repeating Group
A set of fields that can occur multiple times in a single record with different values.
The presence of a repeating group = table is unnormalized (UNF).
📸 Include UNF/repeating group diagram from textbook here
Normalization Stages
UNF → Unnormalized
Problem: Contains repeating groups (e.g., one ORDER row has multiple PRODUCT entries in the same row).
1NF — First Normal Form
Rule: Does not contain a repeating group.
How to fix UNF → 1NF:
- Each repeating group becomes its own row
- Expand the primary key to be composite:
(ORDER + PRODUCT NUMBER)
📸 Include 1NF diagram from textbook here
🍎 Like changing "Order #1: products 304, 633, 684 in one cell" → three separate rows, one per product.
2NF — Second Normal Form
Prerequisite: Must be in 1NF first.
Rule: Every non-key field must depend on the entire composite key — not just part of it.
Partial dependency = a non-key field depends on only part of the composite key → move it to a separate table.
Example:
- Composite PK =
(ORDER, PRODUCT NUMBER) DESCRIPTIONdepends only onPRODUCT NUMBER(not on ORDER) → partial dependency → move to PRODUCT table
Result (from ORDER example):
ORDERtable:ORDER, ORDER DATEPRODUCTtable:PRODUCT NUMBER, DESCRIPTION, SUPPLIER NUMBER, SUPPLIER NAME, ISOORDER LINEtable:ORDER,PRODUCT NUMBER, NUMBER ORDERED
📸 Include 2NF diagram from textbook here
3NF — Third Normal Form
Rule: No transitive dependencies — a non-key field must NOT depend on another non-key field.
Transitive dependency = non-key field A depends on non-key field B (instead of depending on the PK).
Example:
- In PRODUCT table:
SUPPLIER NAMEdepends onSUPPLIER NUMBER(not onPRODUCT NUMBER) → transitive dependency - Fix: Split into:
PRODUCT: PRODUCT NUMBER, DESCRIPTION, SUPPLIER NUMBERSUPPLIER: SUPPLIER NUMBER, SUPPLIER NAME, ISO
📸 Include 3NF diagram from textbook here
🍎 The easy mnemonic: "The key, the whole key, and nothing but the key — so help me Codd."
Normalization Quick Summary
| Stage | Rule | Problem it solves |
|---|---|---|
| UNF | Has repeating groups | — (starting point) |
| 1NF | No repeating groups; expand PK | Eliminates repeating data in one cell |
| 2NF | No partial dependencies on composite PK | Eliminates redundancy from partial key reliance |
| 3NF | No transitive dependencies | Eliminates non-key → non-key dependencies |
Why normalize? → Redundant data = storage waste + update anomalies. If supplier name is stored in 100 product rows and the supplier renames, you must update 100 rows — and if you miss one, data is inconsistent.
🔑 Codes
Codes are shorter than the data they represent.
Benefits:
- Save storage space and costs
- Decrease data entry and transmission time
- Reveal or conceal information
- Reduce data input errors
- Easier to remember
Types of Codes
| Type | Description | Example |
|---|---|---|
| Sequence codes | Numbers/letters assigned in order | Employee #001, #002, #003 |
| Block sequence codes | Blocks of numbers for categories | 100–199: Sales, 200–299: HR |
| Category codes | Letters identifying a group | M = Male, F = Female |
| Abbreviation codes | Alphabetic abbreviations | TH = Thailand |
| Mnemonic codes | Easy-to-remember combinations | NYC = New York City |
| Significant digit codes | Subgroups of digits with meaning | 12-34-56 (dept-floor-room) |
| Derivation codes | Combine data from multiple attributes | First 3 letters of name + birth year |
| Cipher codes | Use a keyword to encode | Secret encoding |
| Action codes | Indicate what action to take | D = Delete, U = Update |
Designing Codes — Rules
- Keep codes concise and consistent
- Allow for expansion (future growth)
- Keep codes stable and unique
- Use sortable codes with a simple structure
- Avoid confusion; make codes meaningful
- Use a code for a single purpose only
💾 Data Storage and Access
Data Warehouse vs. Data Mart vs. Data Mining
| Concept | Definition |
|---|---|
| Data Warehouse | Integrated collection of data from multiple systems across the entire organization — any dimension can be queried |
| Data Mart | A smaller warehouse designed to serve a specific department (e.g., Marketing, Finance) |
| Data Mining | Looks for meaningful patterns and relationships in large datasets |
📸 Include Data Warehouse diagram (Figure showing dimensions: Time Period, Customer, Sales Rep) from textbook here
Warehouse vs Mart: Warehouse = the whole company's data in one place. Mart = a department's slice of that warehouse. Mart is always a subset of the Warehouse.
🍎 Analogy: Data Warehouse = the main stock room of a department store. Data Mart = the stock room for just the shoe department.
Logical vs. Physical Storage
| Type | Description |
|---|---|
| Logical storage | Data as the user sees and accesses it — regardless of how or where it's physically stored |
| Physical storage | Strictly hardware-related — reading/writing binary data to actual physical media |
Why does this distinction matter? Users don't need to know that "Customer" data is split across three servers. They just see a clean table. That's logical storage abstracting physical storage.
🍎 Logical = what you see in Excel. Physical = the actual bits written to the SSD.
🔤 Data Coding (Character Encoding)
| Format | Used In |
|---|---|
| EBCDIC | Mainframe computers and high-capacity servers |
| ASCII | Most personal computers |
| Binary storage format | Represents numbers as actual binary values |
| Unicode | International standard — 2 bytes (16 bits) per character |
Unicode supports Thai, Chinese, Arabic, and virtually every human language in one standard.
Storing Dates
- ISO format: — 4-digit year, 2-digit month, 2-digit day
- Absolute date: total number of days elapsed from a specific base date (used for date arithmetic)
🔒 Data Control
A well-designed DBMS must provide built-in control and security.
| Control Measure | Purpose |
|---|---|
| Limited access to files and databases | Prevent unauthorized viewing/modification |
| User ID and passwords | Authentication |
| Permissions and encryption | Control what each user can do; protect data in transit |
| Backup copies | Retained for a specified period |
| Recovery procedures | Restore lost or damaged data |
📊 Quick Comparison — Key "This vs That"
| vs | A | B |
|---|---|---|
| File-oriented vs Relational | Separate files, data duplicated | Linked tables via common field, no redundancy |
| Schema vs Subschema | Full database description | Portion a specific user/system can access |
| Primary vs Foreign Key | Uniquely identifies a record in its own table | References a PK in another table to link them |
| Primary vs Candidate Key | The chosen unique identifier | Any field that could be PK (multiple may exist) |
| Data Warehouse vs Data Mart | Entire organization's data | One department's subset of that data |
| Logical vs Physical Storage | How users see data | How data is actually stored in hardware |
| 1NF vs 2NF vs 3NF | No repeating groups | No partial dependencies |
📝 Key Definitions (Exam-Ready)
| Term | Definition |
|---|---|
| Data structure | A framework for organizing, storing, and managing data |
| DBMS | Collection of tools for adding, updating, managing, accessing, and analyzing data |
| Schema | Description of all fields, tables, and relationships in the database |
| Subschema | The portion of the database a specific user or system can access |
| ODBC | Open Database Connectivity — standard for DBMS software communication |
| Middleware | Software that integrates different applications and allows data exchange |
| Entity | A person, place, thing, or event for which data is collected |
| Primary Key | Field(s) that uniquely and minimally identify a record |
| Candidate Key | A field that could serve as a primary key |
| Foreign Key | A field that must match a primary key in another table |
| Referential integrity | Rules ensuring foreign key values always refer to existing primary keys |
| ERD | Entity-Relationship Diagram — graphic showing entities and their relationships |
| Associative entity | A bridge table that resolves a M:N relationship into two 1:M relationships |
| Cardinality | The numeric relationship between two entities |
| Normalization | Process of designing tables to eliminate redundancy and anomalies |
| Repeating group | A set of fields that can occur multiple times in one record — signals UNF |
| Partial dependency | Non-key field depends on only part of a composite PK — violates 2NF |
| Transitive dependency | Non-key field depends on another non-key field — violates 3NF |
| Data Warehouse | Integrated collection of data from multiple systems across the organization |
| Data Mart | A smaller warehouse serving a specific department |
| Data Mining | Looking for meaningful patterns and relationships in large datasets |
| Logical storage | Data as seen by the user, regardless of physical location |
| Physical storage | Actual binary data written to hardware |
| Unicode | 16-bit character encoding supporting 65,536 characters and international languages |
| ISO date format | YYYYMMDD — international standard for storing dates |
| Absolute date | Number of days elapsed from a specific base date |