0% found this document useful (0 votes)
24 views32 pages

s1.3 Review Database

Uploaded by

Dũng Tạ Quang
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)
24 views32 pages

s1.3 Review Database

Uploaded by

Dũng Tạ Quang
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/ 32

Basic Database Review

Course: Data Warehouse IS 337


What is Data?

In simple words, data can be facts related to any object in consideration

For example:

▪ Name, age, date of birth of a student

▪ File, image, audio can also be considered data


What is Database?
A collection of related data in a certain context
Database Example

Customer Product

Order
Database Example

Customer
Database Example

Product
Database Example

Order
What is Database?
A collection of related data in a certain context

Two main types of database: relational database and non-relational database


Relational Database
• Entity: A specified object in the real world

▪ Example: a bill, a car, a student,…

• Attribute: Property that describes the entity

▪ Example: name, age and identity number are attributes of a student

• Table: A set of entities have similar structure

▪ Example: students at Thang Long University


attributes

an entity
Relational Database
A relational database is a collection of data items with pre-defined relationships
between them.

These items are organized as a set of tables with columns and rows.
Relational Database

Customer Table

Product Table Order Table


23411242 Nguyễn Văn A 04 Pham Ngu Lao, Q.1 123-123-456

Nguyễn Văn A
1175222
903455322 03/27 23411242 04 Pham Ngu Lao, Q.1 1175222 1
Primary key
An attribute (or a list of attributes) that uniquely identifies each row in a table
Primary key
A column (or a list of attributes) that uniquely identifies each row in a table
- No duplicate primary key value
- Every row must have a value in primary key column (primary key cannot be null)
- Value in primary key column should not be modified once created
Foreign key
A referencing key to link two tables together

Foreign keys don’t have to be unique. They can be repeated in a table


Foreign Key

Foreign key
Foreign key
A referencing key to link two tables together

Foreign keys don’t have to be unique. They can be repeated in a table

A table can have multiple foreign keys


Foreign Key

Foreign key
Entity Relationship Diagram
An Entity Relationship (ER) Diagram is a type of flowchart that illustrates how “entities”
such as people, objects or concepts relate to each other within a system.
Entity Relationship Diagram
Entities

Attributes
Entity Relationship Diagram
- Reminder: this is One-to-Many relationship
- To determine optionality, ask this question: Does Entity A have to have entity B?

If Yes: place a single vertical line next to B If No: place a circle next to B
Entity A must have at least 1 Entity B Entity A doesn’t have to have Entity B

You might also like