SlideShare a Scribd company logo
1 of 8
Download to read offline
Relational Database
• Relations can be represented as two-dimensional data tables with rows and
columns.
• The rows of a relation are called tuples.
• The columns of a relation are called attributes.
• The attributes draw values from a domain (a legal pool of values).
• The number of tuples in a relation is called its cardinality while the number of
attributes in a relation is called its degree.
• A relation also consists of a schema and an instance.
• Schema defines the structure of a relation which consists of a fixed set of
attribute-domain pairs.
• An instance of a relation is a time-varying set of tuples where each tuple consists
of attribute-value pairs.
Constraints: Set of rules for the database is known as constraints
• Domain Constraints:
Restrictions on the set of values of the attribute can take can be specified.
• Key Constraints:
A relation is defined to be set of tuples, since a set does not contain duplicates, no
two tuples can be identical.
• Entity Integrity Constraints:
Are the set of rules called by the application and these are applicable on all
instances of the relations
• Referential Integrity Constraint:
This is a special type of integrity constraint that relates two relations and
maintains consistency across the relations.
Data Integrity Data Integrity falls into the following categories:
• Entity integrity
Entity integrity ensures that each row can be uniquely identified by an attribute
called the Primary key. The Primary key cannot have a NULL value.
• Domain integrity
Domain integrity refers to the range of valid entries for a given column. It ensures
that there are only valid entries in the column.
• Referential integrity
Referential integrity ensures that for every value of a Foreign key, there is a
matching value of the Primary key.
Relational Algebra
• Relational Algebra is a procedural language used for manipulating relations.
• The relational model gives the structure for relations so that data can be stored in
that format but relational algebra enables us to retrieve information from relations.
The operators of Relational Algebra are:
• Select:
This is a unary operator that select a subset of tuples of the relation, which satisfy
selection condition. This can be represented by
• Project:
This is also a unary operator, that chooses subset of attributes or columns of a
relation and restricts all the tuples of a relation to those attributes. This is
represented by
The operators of Relational Algebra are:
• Cartesian Product:
This is a binary operator that combines information across two relations.
Cartesian product of two relations
R = (A1, A2, A3, A4, ….) and S = (B1, B2, B3,…) can be represented as:
Q = R X S = (A1, A2, A3, ….. B1, B2, B3,…).
• Join:
This is also a binary operator which is widely used and this operator concatenates
only tuples that satisfy certain conditions.
This is represented by:
Union, Intersection and Difference:
• To have union relations must have same number of attributes and corresponding
attributes must have same domain.
• Also since the result of each of these operators has to be a relation, duplicates are
removed.
Database Planning
• The database design should be adequate for serving different applications.
• Improper database planning will result in loss of data interrelationship,
repeatability of data, loss of data share, loss of control on data etc.
Basically one can classify the needs into three categories as
below:
• Operational database, which contains data assisting day to day activities of the
organization. Ex.: sales, product stock, etc.
• Control database, which contains data assisting needs of middle management to
monitor and control business activities by effective and efficient management of
men, machines and money. For example: monthly performance summaries, sales
statements etc.
• Strategic planning database, which contains data required for top management for
taking long-term decisions like economic policies of government, similar type of
organisation etc.
Steps in Database Planning
• Before designing the database certain decision has to be taken regarding approach
and type of database.
• An organisation may go for single large global database or separate databases
serving different groups of applications.
Single global database
• Results from total systems approach where requirements of entire organisation
and business functions are inter-related.
• This results in minimum redundancy and maximum of data.
• This also allows full control over the data design and access.
• This approach results in more complex database having large number of data
types and relationships and requires considerable time and effort in design and
implementation.
Multiple database approach
• Reduces time and effort required for design and lesser risk in database
management.
• However this approach may lead to problems in sharing of data and inter-
operability.
A database can be designed using top-down and bottom-up
approach. Top-down approach
• Starts with enterprise level model, preparing data model for entire application
domain.
• This approach does not consider specific details of processing.
• The ER model is prepared identifying the main entities and relationships.
• With this approach, there is a possibility of not accounting all user requirements,
missing certain entities or relationships.
Bottom-up approach
• Begins with individual user requirements.
• Data model for each requirement is prepared understating the inputs, outputs and
process.
• These individual models then merged into a single conceptual schema.
• The main disadvantage of this approach is it fails to take into account future
requirements.
After deciding on the approach, planning is carried out for
database design. The important points to be kept in mind
while planning are as listed below:
• Decide on the business steps, which will make use of database.
• Establish database administrative function.
• Perform business system analysis
• Build information model
• Developing data distribution plan.
• Develop Implementation Plan.
• Review.
Database Design
Some guidelines to be followed while designing the database:
• A database design should be unambiguous and easy to understand.
• It should avoid / reduce the redundancy.
• Unrelated data should be in separate table so that updating the data will be easy.
• Design should have no inconsistencies.
• An entity should have attributes, which are generally present for all its instances.
Minimise null values to the attributes in the design.
• Define constraints so that correctness of data will be ensured.
• Design should facilitate information addition in future.
• Maintenance should be easy.
• Some of these can be translated into design principles for good relations.
From the point of view of user, important criteria for designing
are:
• Meaningful grouping of attributes
• No redundancy
• No inapplicable attributes
• Uniformity in naming and definitions of the data items.
Conversion of ER Diagram to Relations
• The ER model represents the conceptual entities and their interrelationships at a
logical level.
• Using some simple rules one can convert ER model to relational database.
• The relational database obtained in this approach will avoid redundancies and
update anomalies.
• This is possible only if ER diagram is drawn correctly.
The rules, which are to be followed to derive the relational
model from the ER diagram, are:
• Define a table for each strong entity where the table has one column for each
simple attribute. The key of the table will be key of the entity itself.
• Define a table for each weak entity. It will contain the primary key of the strong
entity on which it depends, and it will also include attributes of the weak entity.
• Define a table for each relationship where the table consists of the primary keys of
the participating entity sets and the attributes of the relationship itself.
• For one to one relationships, it is not necessary to define a separate table.
• Try to avoid defining a separate table for many to one binary relationship.
• Consider the example of student and course.
• Here the relationship is many to many.
• From the above rules, we can define three tables for this situation namely student
entity, course entity and study relationship.
STUDENT
SUBJECT
STUDY

More Related Content

What's hot (18)

Fundamentals of Database ppt ch01
Fundamentals of Database ppt ch01Fundamentals of Database ppt ch01
Fundamentals of Database ppt ch01
 
Data base management system
Data base management systemData base management system
Data base management system
 
Assignment on dbms
Assignment on dbmsAssignment on dbms
Assignment on dbms
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Database system architecture
Database system architectureDatabase system architecture
Database system architecture
 
Chapter1
Chapter1Chapter1
Chapter1
 
DBMS - RAID
DBMS - RAIDDBMS - RAID
DBMS - RAID
 
Database management system by Gursharan singh
Database management system by Gursharan singhDatabase management system by Gursharan singh
Database management system by Gursharan singh
 
Data abstraction in DBMS
Data abstraction in DBMSData abstraction in DBMS
Data abstraction in DBMS
 
Dbms Networks
Dbms NetworksDbms Networks
Dbms Networks
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
 
Dbms notesization 2014
Dbms notesization 2014Dbms notesization 2014
Dbms notesization 2014
 
Relational database oracle
Relational database  oracleRelational database  oracle
Relational database oracle
 
Dbms
DbmsDbms
Dbms
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms users
 
Lesson 1 data processing
Lesson 1   data processing Lesson 1   data processing
Lesson 1 data processing
 
Architec design introduction
Architec design introductionArchitec design introduction
Architec design introduction
 
Discussion unit 3 2203
Discussion unit 3 2203Discussion unit 3 2203
Discussion unit 3 2203
 

Similar to Relational database (Unit 2)

Unit 2_DBMS_10.2.22.pptx
Unit 2_DBMS_10.2.22.pptxUnit 2_DBMS_10.2.22.pptx
Unit 2_DBMS_10.2.22.pptxMaryJoseph79
 
DBMS data modeling.pptx
DBMS data modeling.pptxDBMS data modeling.pptx
DBMS data modeling.pptxMrwafaAbbas
 
Week 1 and 2 Getting started with DBMS.pptx
Week 1 and 2 Getting started with DBMS.pptxWeek 1 and 2 Getting started with DBMS.pptx
Week 1 and 2 Getting started with DBMS.pptxRiannel Tecson
 
Database Management System
Database Management SystemDatabase Management System
Database Management SystemSelshaCs
 
Specifying data requirments
Specifying data requirmentsSpecifying data requirments
Specifying data requirmentsImran60577
 
Lecture 1. Data Structure & Algorithm.pptx
Lecture 1. Data Structure & Algorithm.pptxLecture 1. Data Structure & Algorithm.pptx
Lecture 1. Data Structure & Algorithm.pptxArifKamal36
 
SQL Tutorial - Basics of Structured Query Language Day 1.pdf
SQL Tutorial - Basics of Structured Query Language Day 1.pdfSQL Tutorial - Basics of Structured Query Language Day 1.pdf
SQL Tutorial - Basics of Structured Query Language Day 1.pdfRiturajDas28
 
Data warehouse 17 dimensional data model
Data warehouse 17 dimensional data modelData warehouse 17 dimensional data model
Data warehouse 17 dimensional data modelVaibhav Khanna
 
ch2-slide Data Models.pptx
ch2-slide Data Models.pptxch2-slide Data Models.pptx
ch2-slide Data Models.pptxTamiratDejene1
 
Chapter-5 The Relational Data Model
Chapter-5 The Relational Data ModelChapter-5 The Relational Data Model
Chapter-5 The Relational Data ModelKunal Anand
 
Module 1 - Chapter 2.pptx
Module 1 - Chapter 2.pptxModule 1 - Chapter 2.pptx
Module 1 - Chapter 2.pptxSoniaDevi15
 
Database Management System NOTES for 2nd year
Database Management System NOTES for 2nd yearDatabase Management System NOTES for 2nd year
Database Management System NOTES for 2nd yeardhasamalika
 
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
 

Similar to Relational database (Unit 2) (20)

Unit 2_DBMS_10.2.22.pptx
Unit 2_DBMS_10.2.22.pptxUnit 2_DBMS_10.2.22.pptx
Unit 2_DBMS_10.2.22.pptx
 
DBMS data modeling.pptx
DBMS data modeling.pptxDBMS data modeling.pptx
DBMS data modeling.pptx
 
DATA MODELS.pptx
DATA MODELS.pptxDATA MODELS.pptx
DATA MODELS.pptx
 
oracle
oracle oracle
oracle
 
DBMS ppts unit1.pptx
DBMS ppts  unit1.pptxDBMS ppts  unit1.pptx
DBMS ppts unit1.pptx
 
Week 1 and 2 Getting started with DBMS.pptx
Week 1 and 2 Getting started with DBMS.pptxWeek 1 and 2 Getting started with DBMS.pptx
Week 1 and 2 Getting started with DBMS.pptx
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Different data models
Different data modelsDifferent data models
Different data models
 
Specifying data requirments
Specifying data requirmentsSpecifying data requirments
Specifying data requirments
 
Lecture 1. Data Structure & Algorithm.pptx
Lecture 1. Data Structure & Algorithm.pptxLecture 1. Data Structure & Algorithm.pptx
Lecture 1. Data Structure & Algorithm.pptx
 
ER modeling
ER modelingER modeling
ER modeling
 
SQL Tutorial - Basics of Structured Query Language Day 1.pdf
SQL Tutorial - Basics of Structured Query Language Day 1.pdfSQL Tutorial - Basics of Structured Query Language Day 1.pdf
SQL Tutorial - Basics of Structured Query Language Day 1.pdf
 
Data warehouse 17 dimensional data model
Data warehouse 17 dimensional data modelData warehouse 17 dimensional data model
Data warehouse 17 dimensional data model
 
relational database
relational databaserelational database
relational database
 
ch2-slide Data Models.pptx
ch2-slide Data Models.pptxch2-slide Data Models.pptx
ch2-slide Data Models.pptx
 
Chapter-5 The Relational Data Model
Chapter-5 The Relational Data ModelChapter-5 The Relational Data Model
Chapter-5 The Relational Data Model
 
T-SQL
T-SQLT-SQL
T-SQL
 
Module 1 - Chapter 2.pptx
Module 1 - Chapter 2.pptxModule 1 - Chapter 2.pptx
Module 1 - Chapter 2.pptx
 
Database Management System NOTES for 2nd year
Database Management System NOTES for 2nd yearDatabase Management System NOTES for 2nd year
Database Management System NOTES for 2nd year
 
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
 

More from Ismail Mukiibi

IP/MAC Address Translation
IP/MAC Address TranslationIP/MAC Address Translation
IP/MAC Address TranslationIsmail Mukiibi
 
Traffic Characterization
Traffic CharacterizationTraffic Characterization
Traffic CharacterizationIsmail Mukiibi
 
Microprocessor application (Introduction)
Microprocessor application (Introduction)Microprocessor application (Introduction)
Microprocessor application (Introduction)Ismail Mukiibi
 
Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2Ismail Mukiibi
 
Advanced computer architect lesson 3 and 4
Advanced computer architect lesson 3 and 4Advanced computer architect lesson 3 and 4
Advanced computer architect lesson 3 and 4Ismail Mukiibi
 
Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Ismail Mukiibi
 
Pc hardware course work
Pc hardware course workPc hardware course work
Pc hardware course workIsmail Mukiibi
 
Mac addresses(media access control)
Mac addresses(media access control)Mac addresses(media access control)
Mac addresses(media access control)Ismail Mukiibi
 
Why building collapse in kampala
Why building collapse in kampalaWhy building collapse in kampala
Why building collapse in kampalaIsmail Mukiibi
 

More from Ismail Mukiibi (12)

Quality of service
Quality of serviceQuality of service
Quality of service
 
IP/MAC Address Translation
IP/MAC Address TranslationIP/MAC Address Translation
IP/MAC Address Translation
 
Traffic Characterization
Traffic CharacterizationTraffic Characterization
Traffic Characterization
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
Html notes
Html notesHtml notes
Html notes
 
Microprocessor application (Introduction)
Microprocessor application (Introduction)Microprocessor application (Introduction)
Microprocessor application (Introduction)
 
Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2Advanced computer architecture lesson 1 and 2
Advanced computer architecture lesson 1 and 2
 
Advanced computer architect lesson 3 and 4
Advanced computer architect lesson 3 and 4Advanced computer architect lesson 3 and 4
Advanced computer architect lesson 3 and 4
 
Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6
 
Pc hardware course work
Pc hardware course workPc hardware course work
Pc hardware course work
 
Mac addresses(media access control)
Mac addresses(media access control)Mac addresses(media access control)
Mac addresses(media access control)
 
Why building collapse in kampala
Why building collapse in kampalaWhy building collapse in kampala
Why building collapse in kampala
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Relational database (Unit 2)

  • 1. Relational Database • Relations can be represented as two-dimensional data tables with rows and columns. • The rows of a relation are called tuples. • The columns of a relation are called attributes. • The attributes draw values from a domain (a legal pool of values). • The number of tuples in a relation is called its cardinality while the number of attributes in a relation is called its degree. • A relation also consists of a schema and an instance. • Schema defines the structure of a relation which consists of a fixed set of attribute-domain pairs. • An instance of a relation is a time-varying set of tuples where each tuple consists of attribute-value pairs. Constraints: Set of rules for the database is known as constraints • Domain Constraints: Restrictions on the set of values of the attribute can take can be specified. • Key Constraints: A relation is defined to be set of tuples, since a set does not contain duplicates, no two tuples can be identical. • Entity Integrity Constraints: Are the set of rules called by the application and these are applicable on all instances of the relations • Referential Integrity Constraint: This is a special type of integrity constraint that relates two relations and maintains consistency across the relations. Data Integrity Data Integrity falls into the following categories: • Entity integrity Entity integrity ensures that each row can be uniquely identified by an attribute called the Primary key. The Primary key cannot have a NULL value.
  • 2. • Domain integrity Domain integrity refers to the range of valid entries for a given column. It ensures that there are only valid entries in the column. • Referential integrity Referential integrity ensures that for every value of a Foreign key, there is a matching value of the Primary key. Relational Algebra • Relational Algebra is a procedural language used for manipulating relations. • The relational model gives the structure for relations so that data can be stored in that format but relational algebra enables us to retrieve information from relations. The operators of Relational Algebra are: • Select: This is a unary operator that select a subset of tuples of the relation, which satisfy selection condition. This can be represented by • Project: This is also a unary operator, that chooses subset of attributes or columns of a relation and restricts all the tuples of a relation to those attributes. This is represented by The operators of Relational Algebra are: • Cartesian Product: This is a binary operator that combines information across two relations. Cartesian product of two relations
  • 3. R = (A1, A2, A3, A4, ….) and S = (B1, B2, B3,…) can be represented as: Q = R X S = (A1, A2, A3, ….. B1, B2, B3,…). • Join: This is also a binary operator which is widely used and this operator concatenates only tuples that satisfy certain conditions. This is represented by: Union, Intersection and Difference: • To have union relations must have same number of attributes and corresponding attributes must have same domain. • Also since the result of each of these operators has to be a relation, duplicates are removed. Database Planning • The database design should be adequate for serving different applications. • Improper database planning will result in loss of data interrelationship, repeatability of data, loss of data share, loss of control on data etc. Basically one can classify the needs into three categories as below: • Operational database, which contains data assisting day to day activities of the organization. Ex.: sales, product stock, etc. • Control database, which contains data assisting needs of middle management to monitor and control business activities by effective and efficient management of men, machines and money. For example: monthly performance summaries, sales statements etc. • Strategic planning database, which contains data required for top management for taking long-term decisions like economic policies of government, similar type of organisation etc. Steps in Database Planning • Before designing the database certain decision has to be taken regarding approach and type of database.
  • 4. • An organisation may go for single large global database or separate databases serving different groups of applications. Single global database • Results from total systems approach where requirements of entire organisation and business functions are inter-related. • This results in minimum redundancy and maximum of data. • This also allows full control over the data design and access. • This approach results in more complex database having large number of data types and relationships and requires considerable time and effort in design and implementation. Multiple database approach • Reduces time and effort required for design and lesser risk in database management. • However this approach may lead to problems in sharing of data and inter- operability. A database can be designed using top-down and bottom-up approach. Top-down approach • Starts with enterprise level model, preparing data model for entire application domain. • This approach does not consider specific details of processing. • The ER model is prepared identifying the main entities and relationships. • With this approach, there is a possibility of not accounting all user requirements, missing certain entities or relationships. Bottom-up approach • Begins with individual user requirements. • Data model for each requirement is prepared understating the inputs, outputs and process. • These individual models then merged into a single conceptual schema.
  • 5. • The main disadvantage of this approach is it fails to take into account future requirements. After deciding on the approach, planning is carried out for database design. The important points to be kept in mind while planning are as listed below: • Decide on the business steps, which will make use of database. • Establish database administrative function. • Perform business system analysis • Build information model • Developing data distribution plan. • Develop Implementation Plan. • Review. Database Design Some guidelines to be followed while designing the database: • A database design should be unambiguous and easy to understand. • It should avoid / reduce the redundancy. • Unrelated data should be in separate table so that updating the data will be easy. • Design should have no inconsistencies. • An entity should have attributes, which are generally present for all its instances. Minimise null values to the attributes in the design. • Define constraints so that correctness of data will be ensured. • Design should facilitate information addition in future. • Maintenance should be easy. • Some of these can be translated into design principles for good relations.
  • 6. From the point of view of user, important criteria for designing are: • Meaningful grouping of attributes • No redundancy • No inapplicable attributes • Uniformity in naming and definitions of the data items. Conversion of ER Diagram to Relations • The ER model represents the conceptual entities and their interrelationships at a logical level. • Using some simple rules one can convert ER model to relational database. • The relational database obtained in this approach will avoid redundancies and update anomalies. • This is possible only if ER diagram is drawn correctly. The rules, which are to be followed to derive the relational model from the ER diagram, are: • Define a table for each strong entity where the table has one column for each simple attribute. The key of the table will be key of the entity itself. • Define a table for each weak entity. It will contain the primary key of the strong entity on which it depends, and it will also include attributes of the weak entity. • Define a table for each relationship where the table consists of the primary keys of the participating entity sets and the attributes of the relationship itself. • For one to one relationships, it is not necessary to define a separate table. • Try to avoid defining a separate table for many to one binary relationship. • Consider the example of student and course. • Here the relationship is many to many. • From the above rules, we can define three tables for this situation namely student entity, course entity and study relationship.