SlideShare a Scribd company logo
1 of 25
Download to read offline
Database Systems
(SWEG2108)
Chapter –3 Database Design
Chapter 3 Outline
• Relational Integrity Rules
• Conceptual DB Design: ER Diagrams - Revision
• Next lesson: Mapping ERD to Relational Model
2
Relational Constraints/Integrity Rules
The different Relational Integrity Rules
• Domain Integrity
• No value of the attribute should be beyond the allowable limits
• Entity Integrity
• In a base relation, no attribute of a Primary Key can assume a value of NULL
• Referential Integrity
• If a Foreign Key exists in a relation, either the Foreign Key value
must match a Candidate Key value in its home relation or the Foreign Key value must be NULL
• Enterprise Integrity
• Additional rules specified by the users or database administrators of
a database are incorporated Database Design 5
Relational Constraints/Integrity Rules - Example
Table 1: Student Table 2: Student
Table 3: Employee
Key constraints
• Super Key:
• Set of attribute or attributes that uniquely identifies a tuple within a relation.
• A key which we just understand or think at the beginning and they can even be
every key in a table
• Candidate Key:
• It is minimal subset of super key
• If any proper subset of a super key is super key then that key cannot be
a candidate key.
• Primary keys:
• The candidate key chosen to uniquely identify each row of data in a table
• The DBA Picks any one of the candidate key to be the primary key
• The rest one of the candidate key become alternate keys
• Foreign key:
• Primary key of another table used to define relationship with another table and
is used to maintain integrity
Database Design 7
What is composite key?
Key constraint Example
• Possible combination of Super keys
• The following key are combinations of candidate keys
• REG_ID is the primary key
• SID and EMAIL become alternate keys Database Design 8
Student Table
Relational Views
There are two kinds of relation in relational database.
1. Base Relation(Named Relation)
– corresponding to an entity in the conceptual schema, whose tuples
are physically stored in the database.
2. View (Unnamed Relation)
– A View is the dynamic result of one or more relational operations
operating on the base relations to produce another virtual relation
that does not actually exist as presented.
– View is a virtually derived relation that does not necessarily exist in
the database but can be produced upon request by a particular user
at the time of request.
Database Design 9
Purpose of a view
Hides unnecessary information from users:
– since only part of the base relation (Some collection of
attributes, not necessarily all) are to be included in the
virtual table.
Provide powerful flexibility and security:
– since unnecessary information will be hidden from the
user there will be some sort of data security.
Provide customized view of the database for users:
– each user is going to be interfaced with his own
preferred data set and format by making use of the
Views.
Database Design 10
Purpose of a view
• Update on views derived from various relations is not
allowed since it may violate the integrity of the database.
• Since aggregation and summary results are computed
from a base relation and does not exist actually.
– Update on view with aggregation and summary is not
allowed.
Database Design 11
Schemas and Instances
• When a database is designed using a
Relational data model
– all the data is represented in a form of a table.
• In such definitions and representation
– there are two basic components of the database.
» Schemas
» Instances
Database Design 12
Schemas and Instances
Database Schema:
– specifies name of relation and the collection of the attributes
(specifically the Name of attributes).
– refer to a description of database or describes how data is to be
structured
– specified during database design
– should not be changed unless during maintenance
Schema Diagrams
– convention to display some aspect of a schema visually
Schema Construct
– refers to each object in the schema (e.g. STUDENT)
• E.g.: STUDENT (FName, LName, Id, Year, Dept, Sex)
Database Design 13
Schemas and Instances
Instances
– is the collection of data in the database at a particular point of time
(snap-shot).
– Also called State or Snap Shot or Extension of the database
– Refers to the actual data in the database at a specific point in time
– State of database is changed any time we add, delete or update an
item.
– Since Instance is actual data of database at some point in time,
changes rapidly
• To define a new database, we specify its database schema to
the DBMS (database is empty)
• database is initialized when we first load it with data
Database Design 14
Database design: has 3 levels
Database Design 16
Database design: Conceptual Design
Database Design 17
Entity Relationship Diagram (ERD)
Database Design 18
ERD…
Database Design 19
ERD Example
Database Design 20
ERD… Cardinality Constraints: 1:1, 1:m, N:M
Database Design 21
Note : Keep in mind that connecting links like those enclosed with stars will have different meaning.
Database Design 22
ERD… Cardinality Constraints: 1:1, 1:m, N:M
ERD … Participation constraints
Database Design 23
Class Exercise: ER Diagram
A simplified requirements of tiny college are as follows:
• A college contains many departments.
• Each department can offer any number of courses.
• Many instructors can work in a departments.
• An instructor can work only in one department.
• For each department there is a head.
• An instructor can be head of only one department.
• Each instructor can offer any number of courses.
• A course can be offered by only one instructor.
• A student can enroll for any number of courses.
• Each course can be enrolled any number of students.
• Construct ER diagram and describe any assumption you take.
• Show the min. and max. cardinalities.
• State the degree of relation ship between entities.
Answer : ER Diagram
Note : Keep in mind that connecting links like those enclosed with star are wrongly connected.
Home Work : ER Diagram
Answer: ER Diagram
Thank
you!

More Related Content

Similar to Chapter – 3 Database Design P-I.pdf

Entity relationship (er) modeling
Entity relationship (er) modelingEntity relationship (er) modeling
Entity relationship (er) modelingDhani Ahmad
 
Chapter – 2 Data Models.pdf
Chapter – 2 Data Models.pdfChapter – 2 Data Models.pdf
Chapter – 2 Data Models.pdfTamiratDejene1
 
02010 ppt ch04
02010 ppt ch0402010 ppt ch04
02010 ppt ch04ams1ams1
 
Fundamentals of Database ppt ch04
Fundamentals of Database ppt ch04Fundamentals of Database ppt ch04
Fundamentals of Database ppt ch04Jotham Gadot
 
Module 1 - Chapter 2.pptx
Module 1 - Chapter 2.pptxModule 1 - Chapter 2.pptx
Module 1 - Chapter 2.pptxSoniaDevi15
 
02010 ppt ch02
02010 ppt ch0202010 ppt ch02
02010 ppt ch02Hpong Js
 
Database management system.pptx
Database management system.pptxDatabase management system.pptx
Database management system.pptxAshmitKashyap1
 
Week 2 - Database System Development Lifecycle-old.pptx
Week 2 - Database System Development Lifecycle-old.pptxWeek 2 - Database System Development Lifecycle-old.pptx
Week 2 - Database System Development Lifecycle-old.pptxNurulIzrin
 
Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03Jotham Gadot
 
Data Models - Department of Computer Science & Engineering
Data Models - Department of Computer Science & EngineeringData Models - Department of Computer Science & Engineering
Data Models - Department of Computer Science & Engineeringacemindia
 
DBMS & Data Models - In Introduction
DBMS & Data Models - In IntroductionDBMS & Data Models - In Introduction
DBMS & Data Models - In IntroductionRajeev Srivastava
 

Similar to Chapter – 3 Database Design P-I.pdf (20)

Entity relationship (er) modeling
Entity relationship (er) modelingEntity relationship (er) modeling
Entity relationship (er) modeling
 
Chapter – 2 Data Models.pdf
Chapter – 2 Data Models.pdfChapter – 2 Data Models.pdf
Chapter – 2 Data Models.pdf
 
02010 ppt ch04
02010 ppt ch0402010 ppt ch04
02010 ppt ch04
 
DBMS ppts unit1.pptx
DBMS ppts  unit1.pptxDBMS ppts  unit1.pptx
DBMS ppts unit1.pptx
 
Fundamentals of Database ppt ch04
Fundamentals of Database ppt ch04Fundamentals of Database ppt ch04
Fundamentals of Database ppt ch04
 
Module 1 - Chapter 2.pptx
Module 1 - Chapter 2.pptxModule 1 - Chapter 2.pptx
Module 1 - Chapter 2.pptx
 
02010 ppt ch02
02010 ppt ch0202010 ppt ch02
02010 ppt ch02
 
Database management system.pptx
Database management system.pptxDatabase management system.pptx
Database management system.pptx
 
Database system concepts
Database system conceptsDatabase system concepts
Database system concepts
 
Week 2 - Database System Development Lifecycle-old.pptx
Week 2 - Database System Development Lifecycle-old.pptxWeek 2 - Database System Development Lifecycle-old.pptx
Week 2 - Database System Development Lifecycle-old.pptx
 
Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Database intro
Database introDatabase intro
Database intro
 
DBMS unit 1.pptx
DBMS unit 1.pptxDBMS unit 1.pptx
DBMS unit 1.pptx
 
demo2.ppt
demo2.pptdemo2.ppt
demo2.ppt
 
Sachin noire 2024
Sachin noire 2024Sachin noire 2024
Sachin noire 2024
 
Data Models - Department of Computer Science & Engineering
Data Models - Department of Computer Science & EngineeringData Models - Department of Computer Science & Engineering
Data Models - Department of Computer Science & Engineering
 
Relational model
Relational modelRelational model
Relational model
 
Ch1_Intro-95(1).ppt
Ch1_Intro-95(1).pptCh1_Intro-95(1).ppt
Ch1_Intro-95(1).ppt
 
DBMS & Data Models - In Introduction
DBMS & Data Models - In IntroductionDBMS & Data Models - In Introduction
DBMS & Data Models - In Introduction
 

More from TamiratDejene1

Congestion Control and QOS.ppt
Congestion Control and QOS.pptCongestion Control and QOS.ppt
Congestion Control and QOS.pptTamiratDejene1
 
Analog Transmission.ppt
Analog Transmission.pptAnalog Transmission.ppt
Analog Transmission.pptTamiratDejene1
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfTamiratDejene1
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfTamiratDejene1
 
00-intro-to-classes.pdf
00-intro-to-classes.pdf00-intro-to-classes.pdf
00-intro-to-classes.pdfTamiratDejene1
 
Chapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdfChapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdfTamiratDejene1
 
Chapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdfChapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdfTamiratDejene1
 
Chapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdfChapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdfTamiratDejene1
 
Chapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdfChapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdfTamiratDejene1
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfTamiratDejene1
 
Chapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdfChapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdfTamiratDejene1
 

More from TamiratDejene1 (20)

Ch-3 lecture.pdf
Ch-3 lecture.pdfCh-3 lecture.pdf
Ch-3 lecture.pdf
 
Chapter 2.pptx
Chapter 2.pptxChapter 2.pptx
Chapter 2.pptx
 
Wireless LANs.ppt
Wireless LANs.pptWireless LANs.ppt
Wireless LANs.ppt
 
Data Link Control.ppt
Data Link Control.pptData Link Control.ppt
Data Link Control.ppt
 
Congestion Control and QOS.ppt
Congestion Control and QOS.pptCongestion Control and QOS.ppt
Congestion Control and QOS.ppt
 
Analog Transmission.ppt
Analog Transmission.pptAnalog Transmission.ppt
Analog Transmission.ppt
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdf
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdf
 
00-intro-to-classes.pdf
00-intro-to-classes.pdf00-intro-to-classes.pdf
00-intro-to-classes.pdf
 
DLD Chapter-5.pdf
DLD Chapter-5.pdfDLD Chapter-5.pdf
DLD Chapter-5.pdf
 
DLD Chapter-4.pdf
DLD Chapter-4.pdfDLD Chapter-4.pdf
DLD Chapter-4.pdf
 
DLD Chapter-2.pdf
DLD Chapter-2.pdfDLD Chapter-2.pdf
DLD Chapter-2.pdf
 
DLD Chapter-1.pdf
DLD Chapter-1.pdfDLD Chapter-1.pdf
DLD Chapter-1.pdf
 
DLD_Chapter_1.pdf
DLD_Chapter_1.pdfDLD_Chapter_1.pdf
DLD_Chapter_1.pdf
 
Chapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdfChapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdf
 
Chapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdfChapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdf
 
Chapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdfChapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdf
 
Chapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdfChapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdf
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdf
 
Chapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdfChapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdf
 

Recently uploaded

Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Aminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
Aminabad Call Girl Agent 9548273370 , Call Girls Service LucknowAminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
Aminabad Call Girl Agent 9548273370 , Call Girls Service Lucknowmakika9823
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...Suhani Kapoor
 

Recently uploaded (20)

Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
Decoding Loan Approval: Predictive Modeling in Action
Decoding Loan Approval: Predictive Modeling in ActionDecoding Loan Approval: Predictive Modeling in Action
Decoding Loan Approval: Predictive Modeling in Action
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Aminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
Aminabad Call Girl Agent 9548273370 , Call Girls Service LucknowAminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
Aminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
VIP High Class Call Girls Bikaner Anushka 8250192130 Independent Escort Servi...
 

Chapter – 3 Database Design P-I.pdf

  • 2. Chapter 3 Outline • Relational Integrity Rules • Conceptual DB Design: ER Diagrams - Revision • Next lesson: Mapping ERD to Relational Model 2
  • 3. Relational Constraints/Integrity Rules The different Relational Integrity Rules • Domain Integrity • No value of the attribute should be beyond the allowable limits • Entity Integrity • In a base relation, no attribute of a Primary Key can assume a value of NULL • Referential Integrity • If a Foreign Key exists in a relation, either the Foreign Key value must match a Candidate Key value in its home relation or the Foreign Key value must be NULL • Enterprise Integrity • Additional rules specified by the users or database administrators of a database are incorporated Database Design 5
  • 4. Relational Constraints/Integrity Rules - Example Table 1: Student Table 2: Student Table 3: Employee
  • 5. Key constraints • Super Key: • Set of attribute or attributes that uniquely identifies a tuple within a relation. • A key which we just understand or think at the beginning and they can even be every key in a table • Candidate Key: • It is minimal subset of super key • If any proper subset of a super key is super key then that key cannot be a candidate key. • Primary keys: • The candidate key chosen to uniquely identify each row of data in a table • The DBA Picks any one of the candidate key to be the primary key • The rest one of the candidate key become alternate keys • Foreign key: • Primary key of another table used to define relationship with another table and is used to maintain integrity Database Design 7 What is composite key?
  • 6. Key constraint Example • Possible combination of Super keys • The following key are combinations of candidate keys • REG_ID is the primary key • SID and EMAIL become alternate keys Database Design 8 Student Table
  • 7. Relational Views There are two kinds of relation in relational database. 1. Base Relation(Named Relation) – corresponding to an entity in the conceptual schema, whose tuples are physically stored in the database. 2. View (Unnamed Relation) – A View is the dynamic result of one or more relational operations operating on the base relations to produce another virtual relation that does not actually exist as presented. – View is a virtually derived relation that does not necessarily exist in the database but can be produced upon request by a particular user at the time of request. Database Design 9
  • 8. Purpose of a view Hides unnecessary information from users: – since only part of the base relation (Some collection of attributes, not necessarily all) are to be included in the virtual table. Provide powerful flexibility and security: – since unnecessary information will be hidden from the user there will be some sort of data security. Provide customized view of the database for users: – each user is going to be interfaced with his own preferred data set and format by making use of the Views. Database Design 10
  • 9. Purpose of a view • Update on views derived from various relations is not allowed since it may violate the integrity of the database. • Since aggregation and summary results are computed from a base relation and does not exist actually. – Update on view with aggregation and summary is not allowed. Database Design 11
  • 10. Schemas and Instances • When a database is designed using a Relational data model – all the data is represented in a form of a table. • In such definitions and representation – there are two basic components of the database. » Schemas » Instances Database Design 12
  • 11. Schemas and Instances Database Schema: – specifies name of relation and the collection of the attributes (specifically the Name of attributes). – refer to a description of database or describes how data is to be structured – specified during database design – should not be changed unless during maintenance Schema Diagrams – convention to display some aspect of a schema visually Schema Construct – refers to each object in the schema (e.g. STUDENT) • E.g.: STUDENT (FName, LName, Id, Year, Dept, Sex) Database Design 13
  • 12. Schemas and Instances Instances – is the collection of data in the database at a particular point of time (snap-shot). – Also called State or Snap Shot or Extension of the database – Refers to the actual data in the database at a specific point in time – State of database is changed any time we add, delete or update an item. – Since Instance is actual data of database at some point in time, changes rapidly • To define a new database, we specify its database schema to the DBMS (database is empty) • database is initialized when we first load it with data Database Design 14
  • 13. Database design: has 3 levels Database Design 16
  • 14. Database design: Conceptual Design Database Design 17
  • 15. Entity Relationship Diagram (ERD) Database Design 18
  • 18. ERD… Cardinality Constraints: 1:1, 1:m, N:M Database Design 21 Note : Keep in mind that connecting links like those enclosed with stars will have different meaning.
  • 19. Database Design 22 ERD… Cardinality Constraints: 1:1, 1:m, N:M
  • 20. ERD … Participation constraints Database Design 23
  • 21. Class Exercise: ER Diagram A simplified requirements of tiny college are as follows: • A college contains many departments. • Each department can offer any number of courses. • Many instructors can work in a departments. • An instructor can work only in one department. • For each department there is a head. • An instructor can be head of only one department. • Each instructor can offer any number of courses. • A course can be offered by only one instructor. • A student can enroll for any number of courses. • Each course can be enrolled any number of students. • Construct ER diagram and describe any assumption you take. • Show the min. and max. cardinalities. • State the degree of relation ship between entities.
  • 22. Answer : ER Diagram Note : Keep in mind that connecting links like those enclosed with star are wrongly connected.
  • 23. Home Work : ER Diagram