SlideShare una empresa de Scribd logo
1 de 64
Translation of ER-diagram into Relational Schema Prof. Sin-Min Lee Department of Computer Science CS 157A Lecture 7
Learning Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],9.2 ,[object Object],[object Object]
 
9.
 
Process of Database Design  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],9.
9.
Relational Database Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],9.
Relational Database Model ,[object Object],[object Object],9.
Transforming E-R Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],9.
Transforming E-R Diagrams into Relations ,[object Object],[object Object],[object Object],9.
9.
 
Transforming E-R Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object],9.
9.
Transforming E-R Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object],[object Object],9.
Transforming E-R Diagrams into Relations ,[object Object],[object Object],[object Object],9.
9.
Transforming E-R Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],9.
9.
9.
Primary Key Constraints ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Primary key can not have null value
Foreign Keys, Referential Integrity ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Enforcing Referential Integrity ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Logical DB Design: ER to Relational ,[object Object],CREATE TABLE  Employees  (ssn  CHAR (11), name  CHAR (20), lot  INTEGER , PRIMARY KEY  (ssn) )‏ Employees ssn name lot
Relationship Sets to Tables ,[object Object],[object Object],[object Object],[object Object],CREATE TABLE  Works_In( ssn  CHAR (1), did  INTEGER , since  DATE , PRIMARY KEY  (ssn, did), FOREIGN KEY  (ssn)  REFERENCES  Employees, FOREIGN KEY  (did)  REFERENCES  Departments )‏
Review: Key Constraints ,[object Object],Translation to  relational model? Many-to-Many 1-to-1 1-to Many Many-to-1 budget did Departments dname since lot name ssn Manages Employees
Translating ER Diagrams with Key Constraints ,[object Object],[object Object],[object Object],[object Object],CREATE TABLE  Manages( ssn  CHAR(11) , did  INTEGER , since  DATE , PRIMARY KEY  (did) , FOREIGN KEY  (ssn)  REFERENCES  Employees, FOREIGN KEY  (did)  REFERENCES  Departments )‏ CREATE TABLE  Dept_Mgr( did  INTEGER, dname  CHAR(20), budget  REAL, ssn  CHAR(11) , since  DATE , PRIMARY KEY  (did), FOREIGN KEY  (ssn)  REFERENCES  Employees )‏
Review: Participation Constraints ,[object Object],[object Object],[object Object],lot name dname budget did since name dname budget did since Manages since Departments Employees ssn Works_In
Participation Constraints in SQL ,[object Object],CREATE TABLE  Dept_Mgr( did  INTEGER, dname  CHAR(20), budget  REAL, ssn  CHAR(11)  NOT NULL , since  DATE, PRIMARY KEY  (did), FOREIGN KEY  (ssn) REFERENCES Employees, ON DELETE NO ACTION )‏
Review: Weak Entities ,[object Object],[object Object],[object Object],lot name age pname Dependents Employees ssn Policy cost
 
Translating Weak Entity Sets ,[object Object],[object Object],CREATE TABLE  Dep_Policy ( pname  CHAR(20) , age  INTEGER , cost  REAL , ssn  CHAR(11) NOT NULL , PRIMARY KEY  (pname, ssn), FOREIGN KEY  (ssn)  REFERENCES  Employees, ON DELETE CASCADE )‏
Review: Binary vs. Ternary Relationships ,[object Object],[object Object],[object Object],age pname Dependents Covers age pname Dependents Purchaser Bad design Better design name Employees ssn lot Policies policyid cost Beneficiary policyid cost Policies name Employees ssn lot
Binary vs. Ternary Relationships (Contd.)‏ ,[object Object],[object Object],[object Object],CREATE TABLE  Policies ( policyid  INTEGER , cost  REAL , ssn  CHAR(11)  NOT NULL , PRIMARY KEY  (policyid). FOREIGN KEY  (ssn)  REFERENCES  Employees, ON DELETE CASCADE )‏ CREATE TABLE  Dependents   ( pname  CHAR(20) , age  INTEGER , policyid  INTEGER , PRIMARY KEY  (pname, policyid). FOREIGN KEY  (policyid)  REFERENCES  Policies, ON DELETE CASCADE )‏
 
 
An Example CREATE TABLE Student ( ID   NUMBER, Fname  VARCHAR2(20), Lname  VARCHAR2(20), );
Constraints in Create Table ,[object Object],[object Object],[object Object],[object Object],[object Object]
Not Null Constraint CREATE TABLE Student ( ID   NUMBER, Fname  VARCHAR2(20)  NOT NULL , Lname  VARCHAR2(20)  NOT NULL , );
Primary Key Constraint Primary Key implies: * NOT NULL * UNIQUE.  There can only be one primary key. CREATE TABLE Student ( ID   NUMBER  PRIMARY KEY , Fname  VARCHAR2(20) NOT NULL, Lname  VARCHAR2(20) NOT NULL, );
Primary Key Constraint  (Syntax 2)‏ CREATE TABLE Students ( ID   NUMBER, Fname  VARCHAR2(20) NOT NULL, Lname  VARCHAR2(20) NOT NULL, PRIMARY KEY(ID)‏ ); Needed when the primary key is made up of two or more fields
Another Table CREATE TABLE Studies( Course   NUMBER, Student  NUMBER ); What additional constraint do we want on Student? What should be the primary key?
Foreign Key Constraint NOTE: ID must be unique (or primary key) in Student CREATE TABLE Studies( Course   NUMBER, Student  NUMBER, FOREIGN KEY (Student) REFERENCES   Students(ID)‏ );
Translating ER-Diagrams to Table Definitions
Relations vs. Tables ,[object Object],[object Object],[object Object],[object Object]
Translating Entities ,[object Object],[object Object],[object Object],[object Object],Actor id name address birthday
Translating Entities ,[object Object],[object Object],[object Object],[object Object],Actor id name address birthday Relation: Actor ( id , name, birthday, address)‏
Translating Relationships  (without constraints)‏ ,[object Object],[object Object],[object Object],[object Object],[object Object],Actor id name address birthday Acted In Film title type year salary
Translating relationships  (without constraints)‏ ,[object Object],[object Object],Actor id name address birthday Acted In Film title type year salary
Translating Recursive Relationships  (without constraints)‏ Employee id name address Manages manager worker Relation: Actor ( worker-id ,  manager-id )‏ What would be the table definition?
Translating relationships (key constraints): Option 1 ,[object Object],[object Object],Director id name Directed Film title salary year
Translating relationships (key constraints): Option 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],Director id name Directed Film title salary year What primary and foreign keys are missing?
Translating relationships (key constraints): Option 2 ,[object Object],[object Object],[object Object],[object Object],[object Object],Director id name Directed Film title salary year
Translating relationships (key constraints): Option 2 ,[object Object],[object Object],[object Object],[object Object],[object Object],Director id name Directed Film title salary year What 3 lines are missing?
Translating relationships (key constraints)‏ ,[object Object],A R B C
Translating relationships (participation constraints)‏ ,[object Object],[object Object],[object Object],Director id name Directed Film title salary year
Translating relationships (participation constraints)‏ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Director id name Directed Film title salary year Where should we add NOT NULL?
Translating relationships (participation constraints)‏ ,[object Object],Actor id name Acted In Film title salary year
Translating Weak Entity Sets ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Award Organization Gives year name name phone number money
Translating ISA: Option 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Movie Person ISA id name address picture Director Actor
Translating ISA: Option 2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Movie Person ISA id name address picture Director Actor
Which Option To Choose? ,[object Object],[object Object],[object Object]
Translating Aggregation ,[object Object],[object Object],[object Object],Actor picture Film year type title Acted In salary Award Organization Gives year name name phone number Won

Más contenido relacionado

La actualidad más candente

Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Eddyzulham Mahluzydde
 
The relational data model part[1]
The relational data model part[1]The relational data model part[1]
The relational data model part[1]Bashir Rezaie
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMSkoolkampus
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...Mustafa Kamel Mohammadi
 
The Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database ConstraintsThe Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database Constraintssontumax
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Eddyzulham Mahluzydde
 
Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database languageJafar Nesargi
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...Raj vardhan
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Vidyasagar Mundroy
 
Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2eidah20
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...Raj vardhan
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Eddyzulham Mahluzydde
 

La actualidad más candente (20)

Chapter3
Chapter3Chapter3
Chapter3
 
Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2Chapter 2 Relational Data Model-part 2
Chapter 2 Relational Data Model-part 2
 
The relational data model part[1]
The relational data model part[1]The relational data model part[1]
The relational data model part[1]
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMS
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...
 
The Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database ConstraintsThe Relational Data Model and Relational Database Constraints
The Relational Data Model and Relational Database Constraints
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1
 
Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database language
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...
 
Chapter7
Chapter7Chapter7
Chapter7
 
Lesson03 the relational model
Lesson03 the relational modelLesson03 the relational model
Lesson03 the relational model
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
 
L8 design1
L8 design1L8 design1
L8 design1
 
Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2Chapter3 the relational data model and the relation database constraints part2
Chapter3 the relational data model and the relation database constraints part2
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
 
ch6
ch6ch6
ch6
 
Kul 2
Kul 2Kul 2
Kul 2
 
Relational model
Relational modelRelational model
Relational model
 
Dbms relational data model and sql queries
Dbms relational data model and sql queries Dbms relational data model and sql queries
Dbms relational data model and sql queries
 

Destacado

ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ARADHYAYANA
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mappingShubham Saini
 
Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3) Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3) Aey Unthika
 
Entity Relationship Diagram presentation
Entity Relationship Diagram presentationEntity Relationship Diagram presentation
Entity Relationship Diagram presentationSopov Chan
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Mudasir Qazi
 
How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagramTech_MX
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 
Try PostgreSQL on linux
Try PostgreSQL on linuxTry PostgreSQL on linux
Try PostgreSQL on linuxAey Unthika
 
Vanson Bourne Data Summary: Shadow IT - BDMs
Vanson Bourne Data Summary: Shadow IT - BDMsVanson Bourne Data Summary: Shadow IT - BDMs
Vanson Bourne Data Summary: Shadow IT - BDMsVanson Bourne
 
Prison management system
Prison management system Prison management system
Prison management system SNOW WHITE
 
Example Database normal form
Example Database normal formExample Database normal form
Example Database normal formAey Unthika
 
Special lecture er diagram
Special lecture er diagramSpecial lecture er diagram
Special lecture er diagramNiaz Ali
 
Information system development
Information system developmentInformation system development
Information system developmentDhani Ahmad
 
Assignment 2 of Database (Database Security)
Assignment 2 of Database (Database Security)Assignment 2 of Database (Database Security)
Assignment 2 of Database (Database Security)Aey Unthika
 

Destacado (20)

ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
 
Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3) Assignment 1 of Database (MySQL & Sqlite3)
Assignment 1 of Database (MySQL & Sqlite3)
 
Crj 3 1-b
Crj 3 1-bCrj 3 1-b
Crj 3 1-b
 
Entity Relationship Diagram presentation
Entity Relationship Diagram presentationEntity Relationship Diagram presentation
Entity Relationship Diagram presentation
 
Erd practice exercises
Erd practice exercisesErd practice exercises
Erd practice exercises
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)
 
How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagram
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Er diagram
Er diagramEr diagram
Er diagram
 
Try PostgreSQL on linux
Try PostgreSQL on linuxTry PostgreSQL on linux
Try PostgreSQL on linux
 
Vanson Bourne Data Summary: Shadow IT - BDMs
Vanson Bourne Data Summary: Shadow IT - BDMsVanson Bourne Data Summary: Shadow IT - BDMs
Vanson Bourne Data Summary: Shadow IT - BDMs
 
00137
0013700137
00137
 
Prison management system
Prison management system Prison management system
Prison management system
 
Example Database normal form
Example Database normal formExample Database normal form
Example Database normal form
 
15123 entity relational diagram
15123 entity relational diagram15123 entity relational diagram
15123 entity relational diagram
 
Special lecture er diagram
Special lecture er diagramSpecial lecture er diagram
Special lecture er diagram
 
Information system development
Information system developmentInformation system development
Information system development
 
Assignment 2 of Database (Database Security)
Assignment 2 of Database (Database Security)Assignment 2 of Database (Database Security)
Assignment 2 of Database (Database Security)
 
Lab ex 1
Lab ex 1Lab ex 1
Lab ex 1
 

Similar a Translation of ER Diagram into Relational Schema

Similar a Translation of ER Diagram into Relational Schema (20)

Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
 
Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013
 
DBMS-Unit-2.pptx
DBMS-Unit-2.pptxDBMS-Unit-2.pptx
DBMS-Unit-2.pptx
 
4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf4_RelationalDataModelAndRelationalMapping.pdf
4_RelationalDataModelAndRelationalMapping.pdf
 
DEE 431 Database keys and Normalisation Slide 2
DEE 431 Database keys and Normalisation Slide 2DEE 431 Database keys and Normalisation Slide 2
DEE 431 Database keys and Normalisation Slide 2
 
RDBMS
RDBMSRDBMS
RDBMS
 
NMEC RD_UNIT 1.ppt
NMEC RD_UNIT 1.pptNMEC RD_UNIT 1.ppt
NMEC RD_UNIT 1.ppt
 
Ch3_Rel_Model-95.ppt
Ch3_Rel_Model-95.pptCh3_Rel_Model-95.ppt
Ch3_Rel_Model-95.ppt
 
uniT 4 (1).pptx
uniT 4 (1).pptxuniT 4 (1).pptx
uniT 4 (1).pptx
 
Ch 6 Logical D B Design
Ch 6  Logical D B  DesignCh 6  Logical D B  Design
Ch 6 Logical D B Design
 
Int_SQL.pdf
Int_SQL.pdfInt_SQL.pdf
Int_SQL.pdf
 
2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx
 
Unit04 dbms
Unit04 dbmsUnit04 dbms
Unit04 dbms
 
Fg d
Fg dFg d
Fg d
 
Preparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001dPreparing for BIT – IT2301 Database Management Systems 2001d
Preparing for BIT – IT2301 Database Management Systems 2001d
 
Understanding about relational database m-square systems inc
Understanding about relational database m-square systems incUnderstanding about relational database m-square systems inc
Understanding about relational database m-square systems inc
 
Unit 2 DBMS
Unit 2 DBMSUnit 2 DBMS
Unit 2 DBMS
 
U2_ER_modeling.pptx
U2_ER_modeling.pptxU2_ER_modeling.pptx
U2_ER_modeling.pptx
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
 

Último

Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Último (20)

Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

Translation of ER Diagram into Relational Schema

  • 1. Translation of ER-diagram into Relational Schema Prof. Sin-Min Lee Department of Computer Science CS 157A Lecture 7
  • 2.
  • 3.  
  • 4. 9.
  • 5.  
  • 6.
  • 7. 9.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. 9.
  • 13.  
  • 14.
  • 15. 9.
  • 16.
  • 17.
  • 18. 9.
  • 19.
  • 20. 9.
  • 21. 9.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.  
  • 33.
  • 34.
  • 35.
  • 36.  
  • 37.  
  • 38. An Example CREATE TABLE Student ( ID NUMBER, Fname VARCHAR2(20), Lname VARCHAR2(20), );
  • 39.
  • 40. Not Null Constraint CREATE TABLE Student ( ID NUMBER, Fname VARCHAR2(20) NOT NULL , Lname VARCHAR2(20) NOT NULL , );
  • 41. Primary Key Constraint Primary Key implies: * NOT NULL * UNIQUE. There can only be one primary key. CREATE TABLE Student ( ID NUMBER PRIMARY KEY , Fname VARCHAR2(20) NOT NULL, Lname VARCHAR2(20) NOT NULL, );
  • 42. Primary Key Constraint (Syntax 2)‏ CREATE TABLE Students ( ID NUMBER, Fname VARCHAR2(20) NOT NULL, Lname VARCHAR2(20) NOT NULL, PRIMARY KEY(ID)‏ ); Needed when the primary key is made up of two or more fields
  • 43. Another Table CREATE TABLE Studies( Course NUMBER, Student NUMBER ); What additional constraint do we want on Student? What should be the primary key?
  • 44. Foreign Key Constraint NOTE: ID must be unique (or primary key) in Student CREATE TABLE Studies( Course NUMBER, Student NUMBER, FOREIGN KEY (Student) REFERENCES Students(ID)‏ );
  • 45. Translating ER-Diagrams to Table Definitions
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51. Translating Recursive Relationships (without constraints)‏ Employee id name address Manages manager worker Relation: Actor ( worker-id , manager-id )‏ What would be the table definition?
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.

Notas del editor

  1. 6
  2. 7
  3. 13
  4. 3 The slides for this text are organized into several modules. Each lecture contains about enough material for a 1.25 hour class period. (The time estimate is very approximate--it will vary with the instructor, and lectures also differ in length; so use this as a rough guideline.) This covers Lectures 1 and 2 (of 6) in Module (5). Module (1): Introduction (DBMS, Relational Model)‏ Module (2): Storage and File Organizations (Disks, Buffering, Indexes)‏ Module (3): Database Concepts (Relational Queries, DDL/ICs, Views and Security)‏ Module (4): Relational Implementation (Query Evaluation, Optimization)‏ Module (5): Database Design (ER Model, Normalization, Physical Design, Tuning)‏ Module (6): Transaction Processing (Concurrency Control, Recovery)‏ Module (7): Advanced Topics
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 7
  13. 8
  14. 15