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

Ch4 Data Model

The document outlines the database system design for Build Bright University, focusing on data modeling techniques such as converting E-A-R to tabular form, attribute refinement, and identifying foreign keys. It discusses resolving various relationships (one-to-many, one-to-one, many-to-many) and emphasizes the importance of normalization to reduce data redundancy. Additionally, it provides a data dictionary detailing entities and their attributes for effective database management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Ch4 Data Model

The document outlines the database system design for Build Bright University, focusing on data modeling techniques such as converting E-A-R to tabular form, attribute refinement, and identifying foreign keys. It discusses resolving various relationships (one-to-many, one-to-one, many-to-many) and emphasizes the importance of normalization to reduce data redundancy. Additionally, it provides a data dictionary detailing entities and their attributes for effective database management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Build Bright University Database System Design

CHAPTER IV:

DATA MODEL
1- Convert E-A-R to Tabular Form

2- Attribute Refinement

Page: 19
Build Bright University Database System Design

Result of Attribute Refinement

3- Identify Foreign Keys គឺ ជា key ដែលអ្នក Database Admin ជាអ្នកបង្កើតង ើ្ កនុ្ងោល


បំណ្ភ្ជាប់ទំនាក់ទំ ន្ជាមួ យនឹ្ Primary key។

3.1- Resolving One-To-Many Relationship

Which is the better way?

a)- Putting foreign key to Customer (‘one’ Side)

b)- Putting foreign key to Order (‘many’ Side)

Page: 20
Build Bright University Database System Design
Resolving One-To-Many Relationship
(Continues)
a)- Putting foreign key to Customer (‘one’ Side)

b)- Putting foreign key to Order (‘many’ Side)

1
វាគឺជា Foreign key ដែលបានមកពី
M
ដននក ខា្ One => វាជាែំ ង ោះ
ស្រាយដែលលអ ។

Page: 21
Build Bright University Database System Design

3.2- Resolving One-To-One Relationship

Which is the better solution?

a)- Putting foreign key to Employee Side

b)- Putting foreign key to Title Side

C)- OR . . .?

Page: 22
Build Bright University Database System Design
Resolving One-To-One Relationship
(Continues)

a)- Putting foreign key to Employee Side

Null
Or
Space

- No duplicated data
- Null value or space may occur

b)- Putting foreign key to Title Side

94874875

954309 - No duplicated data


- Not Null value or space

c)- ស្របសិន ងបើ តារា្ពី រនឹ្ ស្រតូ វបានចូ លងស្របើ ជាមួយោនាញឹក ញាប់ ងនាោះងយើ្ អាច
COMBINE THE TABLE INTO ONE

- No duplicated data
- Not Null value or space may occur
- No table joining

Page: 23
Build Bright University Database System Design
3.3- Resolving Many-To-Many Relationship

Which is the better solution?

a)- Putting foreign key to either of the ‘many’ sides.

b)- Combining two tables into one

Resolving MANY-TO-MANY Relationship


(Continues)
a)- Putting foreign key to either of the ‘many’ sides.
(1) Foreign Key to Product.

Pro_ID is not the primary key anymore

(2) Foreign Key to Order.

• Data Redundancy occurs!

Page: 24
Build Bright University Database System Design
b)- Combining two tables into one

• Data Redundancy occurs!!


• Hard to manage Product
info and Order Info

c)- Create a new table using the primary key of both tables (Associative table).

1
1
OrderProduct => Associative Entity
M
M

- Less data redundancy.


- Easy to manage each information individually.

Associative Entity

Page: 25
Build Bright University Database System Design

4- Normalization

is a database design technique that reduces data redundancy. Normalization rules


divide larger tables into smaller tables and links them using relationships.

4.1- Functional Dependency

Page: 26
Build Bright University Database System Design

Page: 27
Build Bright University Database System Design

Page: 28
Build Bright University Database System Design

Page: 29
Build Bright University Database System Design

Page: 30
Build Bright University Database System Design

Page: 31
Build Bright University Database System Design

Page: 32
Build Bright University Database System Design

Page: 33
Build Bright University Database System Design

Logical Data Model គឺ ជាទស្រម្់ទិ ននន័ យដែលបានឆ្ល្ កាត់ ការស្រតួត ពិនិតា យ និ្ង ោះស្រាយនូ វ
រាល់បញ្ហាទិននន័ យសទួន តាមកាបួន របស់ Data Analysis ដែលមានែូច ជា៖ Functional Analysis (Data Flow
Diagram), Conceptual Design (E.A.R Model), and Logical Design (Normalization: 1NF, 2NF, 3NF) ជាងែើ
ម។
សូមបញ្ជាក់ន្ដែរថាសស្រមាប់ Data ដែលងយើ្ យកមកង្វើ Normalization ៖

o ស្របសិន ងបើងយើ្ Apply តាមចាាប់ របស់ 1NF ង ើយមិន មានង ើញមានទិននន័ យ Repeat
ងនាោះងទ => Data ងនាោះវាកាលាយងៅជា 1NF ង យសវ័យស្របវតតិ ។
o ស្របសិន ងបើងយើ្ យក 1NF ងៅ Apply តាមចាាប់ របស់ 2NF ង ើយមិន មានង ើញមាន
Non-key ដែលពឹ្ ដតងៅងលើដននក មាខា្ នន Primary key ងនាោះងទ => Data ងនាោះវា
កាលាយងៅជា 2NF ង យសវ័យស្របវតតិ។
o ស្របសិន ងបើងយើ្ យក 2NF ងៅ Apply តាមចាាប់ របស់ 3NF ង ើយមិន មានង ើញមាន
Non-key ដែលពឹ្ ងៅងលើ Non-key ែនទងទៀតងនាោះងទ => Data ងនាោះវាកាលាយងៅជា
3NF ង យសវ័យស្របវតតិ។

ជាចុ្ងស្រកាយគឺ ងយើ្ទទួលបាននូវទស្រម្់ Data Model ដែលមានស្របសិទធ ភ្ព សស្រមាប់


ែំងណើរការការងារបនតរ ែូច ខា្ងស្រកាម៖

DATA DICTIONARY
Data Dictionary ស្រតូ វបានបង្កើត ង ើ្កនុ្ ងោលបំណ ្ទុក ងអាយ Programmer យកងៅងស្របើ
ស្របាស់សស្រមាប់ប ង្កើត Tables ងៅកនុ្ RDBMS = Relational Database Management System (Ms-Access,
Ms-SQL Server, My SQL, Oracle, Postgres…)

Page: 34
Build Bright University Database System Design
1- ENTITIES NAME/TABLE NAME: TblEmployee
ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
EmpID char(5) N PK
Collation => Windows
EmpName nvarchar(MAX) N
Collation = Khmer_100
EmpGender nchar(1) N
DOB date N
Position nvarchar(MAX) Y
Salary money Y
Address nvarchar(MAX) N
EmpContact varchar(MAX) Y
Hired date N
Photo varbinary(MAX) Y
Stopwork bit Y

2- ENTITIES NAME/TABLE NAME: TblCustomer

ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
Identity Specification
CusID int N PK
=> (Is Identity) => Yes
Collation => Windows
CustName nvarchar(MAX) Y
Collation = Khmer_100
Collation => Windows
CusGender nchar(1) Y
Collation = Khmer_100
CusContact varchar(MAX) Y
CustAddress nvarchar(MAX) Y

3- ENTITIES NAME/TABLE NAME: TblSupplier

ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
Identity Specification
SupID int N PK
=> (Is Identity) => Yes
Collation => Windows
SupName nvarchar(MAX) Y
Collation = Khmer_100
Collation => Windows
SupContact nvarchar(MAX) Y
Collation = Khmer_100

Page: 35
Build Bright University Database System Design
4- ENTITIES NAME/TABLE NAME: TblCategory

ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
Identity Specification
CatID int N PK
=> (Is Identity) => Yes
Collation => Windows
CatName nvarchar(MAX) Y
Collation = Khmer_100

5- ENTITIES NAME/TABLE NAME: TblProduct

ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
ស្រគប់ Barcode ទំ្
ProCode vachar(13) N PK
អ្ស់មាន១៣ខ្ទ ្់
Y Collation => Windows
ProName nvarchar(MAX)
Collation = Khmer_100
Qty_In int Y
Price_In money Y
Price_Out money Y
CatID int N FK TblCategory

6- ENTITIES NAME/TABLE NAME: TblImport


ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
ImpID int N PK
ImpDate datetime N
SupID Int Y FK TblSupplier
EmpID Char(5) Y FK TblEmployee
ImportTotal money N

7- ENTITIES NAME/TABLE NAME: TblSale


ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
SaleID int N PK
SaleDate datetime N
EmpID Char(5) Y FK TblEmployee
CatID int Y FK TblCustomer
SaleTotal money N
Page: 36
Build Bright University Database System Design

8- ENTITIES NAME/TABLE NAME: TblImportDetails


ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
ImpID int N FK/PK TblImport
ProCode varchar(13) N FK/PK TblProduct
ImpQty int N
ImpPrice money N
ImpAmount Money N

9- ENTITIES NAME/TABLE NAME: TblSaleDetail


ATTRIBUTE PK FK
Allow
OR DATA TYPE COLUMN PROPERTIES OR REFERENCED
Nulls
COLUMN FK TABLE
SaleID int N FK/PK TblSale
ProID varchar(13) N FK/PK TblProduct
SaleQty int N
SalePrice money N
SaleAmount money N

Assignment (Continues)
5- Data Model:
5-1- Convert E-A-R to Tabular Form
5-2- Attribute Refinement
5-3- Identify Foreign Keys (Resolved One to One, One to Many, Many to Many)
5-4- Normalization (1NF, 2NF, 3NF)
5-5- Data Dictionary

Page: 37

You might also like