SlideShare uma empresa 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a Eer >r.model (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

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Eer >r.model

  • 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 do 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