Lecture 1 - DB Concepts and ER Model
Lecture 1 - DB Concepts and ER Model
ER MODEL
Instructor:
By the end of this lecture students Understand an overview of the basic RDBMS
Concepts
should be able to:
SQL OVERVIEW
Structured
Query
Language
➢ Which is a computer language for:
✓ storing,
✓ manipulating and
✓ retrieving data stored in relational database.
➢ SQL is the standard language for Relation Database System, like MySQL, MS
Access, Oracle, Sybase, Informix, Postgres and SQL Server use SQL as
standard database language.
➢ SQL is an ANSI (American National Standards Institute) standard.
5
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
SQL Process
Query Language
SQL Query Parser + Opimizer
Processor
File Manager
DBMS Engine +
Transaction manager
Physical Database
7
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Section 2
Table
Field
10
Relational Database Concepts (3/3)
Primary
Supplier Key Domain Domain
S1 Kamran 20 Lahore
S2 Zafar 10 Islamabad
Row/
Record
S3 Azmat 40 Karachi Cardinality
S4 Abdul 34 Lahore
S5 Nasir 25 Islamabad
Field
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 11
Schema (1/2)
The name of a relation and the set of attributes for a relation is called a
schema.
– Example: the schema for previous slide is
Supplier (SCode, SName, Quantity, City)
Relation schema = name(attributes) + other structure info., e.g., keys,
other constraints.
Order of attributes is arbitrary, but in practice we need to assume the
(standard) order given in the relation schema.
Relational database schema = collection of relation schemas.
✓ IBM DB2,
✓ Oracle,
✓ MySQL,
ER MODEL
▪ Specification Requirement
database
Conceptual ▪ Modelling
design ▪ Design
Conceptual
▪ ER Modelling
model
……..
Entity
A special entity
symbols that is also a
relationship
Relationship Attribute
symbols symbols
EMPLOYEE DEPARTMENT
➢ One – to – many:
DEPARTMENT EMPLOYEE
21
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Cardinality of Relationships (2/2)
➢ Many – to – many:
EMPLOYEE PROJECT
❖ In which:
CUSTOMER relation
Again, no null value in the foreign key…this is because of the mandatory minimum cardinality
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 29
Converting ER Model to relational schema
Rule 7 – Convert Unary relationship many to many
31
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Converting ER Model to relational schema
Another - Convert Ternary relationship
✓ SQL Overview
• SQL, SQL Process, SQL Command
✓ The Relational Database
• Table, Field, Record, Schema
✓ RDBMS Concepts
• RDBMS, RDBMS vs DBMS
✓ ER Model
• Design Process, Notation, Converting ER Model to relational
schema