SlideShare una empresa de Scribd logo
1 de 6
Lecture 2 - Relational Model
1
Fall 2001 Database Systems 1
Relational Model
• In the relational data model
– a database is a set of tables (with additional constraints,
programs and interfaces)
– a schema is the description of tables in a database
– a relation or a table is a “set” of tuples
– a tuple or a record is a mapping from a set of attributes to their
values
– an attribute is a slot for recording data, it has a name and a
domain of applicable values
– the schema of a table contains the table’s name and the
attributes and the domain of the attributes
Fall 2001 Database Systems 2
Example Database - Auction
• OWNERS - people who sell items
– Oid unique identifier given to them
– Name their name
– Email their e-mail address
• ITEMS - the items sold by “owners”
– Iid unique identifier of an item being sold
– Oid the owner of the item
– Name description of the item
– Location location of the item
• BUYERS - registered buyers allowed to bid on items
– Buyid buyer identifier
– Name buyer’s name
– Email buyer’s e-mail address
Lecture 2 - Relational Model
2
Fall 2001 Database Systems 3
Example Database - Auction
• BIDS - people place bids on a specific item of a
specific owner
– Bid unique identifier of a bid
– Date the date it was put online
– Iid which item
– Oid who owns the item
– Buyid who placed the bid
– Amount how much is the buyer bidding
• Additional logic:
– BIDS and ITEMS contain all the “unsold” items.
As soon as an item is sold, it is deleted from
bids and items. The loosing bidders are notified
that they lost the item.
Fall 2001 Database Systems 4
 ¢¡¤£¦¥¨§¨©   £ ¥ ! 
#%$ (') 021 Smith@aol.com
#¦3 4657198A@ Johns@geocities.com
#B C9DE5GF8 Brown@netmail.com
#IH PQDERTS Gray@microsoft.com
UVXW(Y`¨a U9bTcde f¢gihqp Y¨hqg!d r
sut vXwExAy Gray@microsoft,com
€¨ ‚9ƒ„7…9†ˆ‡2‰ Robert432@aol.com
€9 ‘uƒi’“”‰ Johns@somewhere.co
m
€7• ‘¨–7‰Aƒ“ Jj@yahoo.com
€9— ˜Q™edA… Duke@jazz.com
fegih¨jk f!lm nlm oqpqir setTuGpevGltew
x9y z¦y {I|E}e~e€A
‚GƒT„ …
†i‡TˆA}”‡|
x9‰ z¦‰ Š6‹iƒeŒTeˆT…Geƒeˆ
Ž ‡G„ …i7}2‘“’
”i‡e€AˆA}E‡!|
x• z¦‰ Š6‹iƒeŒTeˆT…Geƒeˆ
Ž ‡G„ …i7}2‘“’
–qe—
˜u‡e2Œ
™7š ›¢œ !žeŸE A¡7¢E¢2¡ £6¤i¥ ¥¤G¦
™§ ›qš ¨¨¤e©e©ª7«
!ži¥ ¥¡i¬A¢T­ž®
¯ ¡7¤T¢”¢e¥¡
™i° ›¦± !žeŸE A¡7¢E¢2¡ ²ižT¦A¢”ž®
³9´9µQ¶ ³u·¸ µX¹iº2» ´!· ¸ ¼¦· ¸ ³9½T¾!´i¸ ¿ÀqÁ7½7ÂGº
ÃuÄ ÅuÆ Ç9È7É9Ê Ë!Æ Ì¦Æ ÃuÍ ÆÎʨÊ
ÃuÄ ÅuÍ Ç9È7É9Ê ËeÏ ÌÉ Ã¨Ð É9ʨÊ9ʨÊ
ÃuÄ Å¨É Ç9È7ÉuÆ Ë!Æ Ì¦Æ ÃuÍ Æ”Í!Ê
ÃuÄ Å!Ï Ñ9ÈiÆ ËiÒ ÌÉ Ã¨Ð ÍÏuÊ9ʨÊ
ÃuÄ Å¨Ð Ñ9ÈiÆ Ë!Æ Ì¦Æ ÃuÍ Æ”Í¨Æ
ÃuÄ ÅÒ Ñ9ÈiÍ ËeÏ ÌÉ Ã!Ï É¨Ð9Ê9ʨÊ
ÃuÄ Å9Ó Ñ9ÈiÍ Ë!Í Ì¦Í ÃuÆ ÍÐ9Ê
ÃuÄ ÅÇ Ñ9È7É Ë!Í Ì¦Í Ã¨É Í!ʨÊ
Lecture 2 - Relational Model
3
Fall 2001 Database Systems 5
Attributes and Domains
• Let D1 = the letter “O” followed by the set of all
integers
D2 = the set of all strings up to 30 characters
that contain only letters A-Z,a-z
D3 = the set of all strings that contain a single
@ symbol, and a combination of
Alphanumeric characters and “.”.
Then, owners relation has schema
Owners(OID:D1, Name:D2, Email:D3)
Fall 2001 Database Systems 6
Attributes - Domains
• All tuples in Owners come from
– D1 × D2 × D3
– An example tuple: OID:O1, Name: ’Smith’,
Email: ‘smith@aol.com’
– For any tuple: OID:v1, Name: v2, Email: v3
we have the property that v1 ∈ D1, v2 ∈ D2, v3 ∈ D3
• We usually abuse notation and assume an ordering
for the attribute/domain pairs, and write the relation
schema as:
Owners(OID, Name, Email)
and a tuple as:
O1,’Smith’,’smith@aol.com ∈ Owners
Lecture 2 - Relational Model
4
Fall 2001 Database Systems 7
More on domains
• A domain is a type in the programming language sense
• Domain values is a set of acceptable values for a
variable of a given type.
– Zipcode: zipcodeDomain = {11111, … ,99999},
– Grants: availableGrants = {50,000, … ,1,000,000}
– Simple/Composite domains
• Address = Street name+street number+city+province+ postal code
• Domain compatibility
– Binary operations (e.g., comparison to one another, addition, etc)
can be performed on them.
• Full support for domains is not provided in many current
relational DBMSs
Fall 2001 Database Systems 8
Relation Instances
• A relation/table instance is a set of tuples with a
specific schema (attribute/domain pairs)
List form:
OWNERS(OID,Name,Email) = { O1, Smith, smith@aol.com,
O2, Johns, johns@geocities.com, O3, Brown,
Brown@netmail.com, O4, Gray, Gray@microsoft.com }
Tabular form: Ô Õ¤Ö¦×uب٠ÔÚ Û ÖÜiÝIÞ ×¨ÝqÜ!Ú ß
à%á âäã¦åæAç Smith@aol.com
à¦è é6êeç9ëTì Johns@geocities.com
àí î!ïEêeðië Brown@netmail.com
àIñ òQïEóAô Gray@microsoft.com
Lecture 2 - Relational Model
5
Fall 2001 Database Systems 9
Relational Model
Based on finite set theory:
• First Normal Form Rule: all attributes take simple
values - no set values are allowed.
• Rows are accessed only by their content. The order of
tuples does not have any meaning.
• The order of columns does not have any specific
meaning either.
• No two tuples can have the same values for all the
attributes, i.e. relations are sets.
• Commercial systems allow duplicates (so bag
semantics)
Fall 2001 Database Systems 10
Keys
• A superkey is a set of attributes that help uniquely
identify a specific tuple
– if no two owners may have the same Oid, then Oid
is a superkey
– if no two owners may have the same email
address, then Email is a superkey
• How about:
– Oid + Name (together) for Owners?
– Oid + Name (together) for ITEMS?
– Iid + Oid (together) for ITEMS?
Lecture 2 - Relational Model
6
Fall 2001 Database Systems 11
Keys
• Given relation T, we use t[A1,…,Ak] to denote tuples with only
attributes A1,…,Ak
– for example, if t = O1, Smith, smith@aol.com then
t[oid,name] = O1, Smith
• Given a relation T with attributes {A1,…,Ak}, a key is a set of
attributes {B1,…,Bm} ⊆ {A1,…,Ak} such that
– if u and v are distinct tuples in relation T, then u[B1,…,Bm] and
v[B1,…,Bm] are necessarily different from each other by user
design!
– no proper subset of {B1,…,Bm} has this property
• Every table must have a unique primary key
– Primary key is a key designated by the user and managed by
the system
Fall 2001 Database Systems 12
Null values
• Attributes may be allowed to have null values because
– a value does not exist for a tuple
– a value exists, but it is not known
– it is not known whether a value exists or not
• Integrity rule: No column in a primary key can have null
values

Más contenido relacionado

La actualidad más candente

Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQL
Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQLSql notes, sql server,sql queries,introduction of SQL, Beginner in SQL
Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQLPrashant Kumar
 
Sql practise for beginners
Sql practise for beginnersSql practise for beginners
Sql practise for beginnersISsoft
 
Relational database management system
Relational database management systemRelational database management system
Relational database management systemPraveen Soni
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginnersRam Sagar Mourya
 
Learning sql from w3schools
Learning sql from w3schoolsLearning sql from w3schools
Learning sql from w3schoolsfarhan516
 
Advanced SQL Webinar
Advanced SQL WebinarAdvanced SQL Webinar
Advanced SQL WebinarRam Kedem
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1Iblesoft
 
SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)Edu4Sure
 

La actualidad más candente (20)

Sql for biggner
Sql for biggnerSql for biggner
Sql for biggner
 
Ankit
AnkitAnkit
Ankit
 
Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQL
Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQLSql notes, sql server,sql queries,introduction of SQL, Beginner in SQL
Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQL
 
Sql
SqlSql
Sql
 
Sql practise for beginners
Sql practise for beginnersSql practise for beginners
Sql practise for beginners
 
Rdbms day3
Rdbms day3Rdbms day3
Rdbms day3
 
Relational database management system
Relational database management systemRelational database management system
Relational database management system
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
 
BIS05 Introduction to SQL
BIS05 Introduction to SQLBIS05 Introduction to SQL
BIS05 Introduction to SQL
 
SQL Language
SQL LanguageSQL Language
SQL Language
 
Learning sql from w3schools
Learning sql from w3schoolsLearning sql from w3schools
Learning sql from w3schools
 
SQL
SQLSQL
SQL
 
Advanced SQL Webinar
Advanced SQL WebinarAdvanced SQL Webinar
Advanced SQL Webinar
 
Sql slid
Sql slidSql slid
Sql slid
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
 
SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)
 
Oraclesql
OraclesqlOraclesql
Oraclesql
 

Similar a [Www.pkbulk.blogspot.com]dbms02

Databases for beginners.pdf
Databases for beginners.pdfDatabases for beginners.pdf
Databases for beginners.pdffikadumola
 
15 wordprocessing ml subject - fields and hyperlinks
15   wordprocessing ml subject - fields and hyperlinks15   wordprocessing ml subject - fields and hyperlinks
15 wordprocessing ml subject - fields and hyperlinksShawn Villaron
 
[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03AnusAhmad
 
Apl – a programming language
Apl – a programming languageApl – a programming language
Apl – a programming languageBryan Wilson
 
PhillyR 18-19 Kickoff - Data Structure Intro
PhillyR 18-19 Kickoff - Data Structure IntroPhillyR 18-19 Kickoff - Data Structure Intro
PhillyR 18-19 Kickoff - Data Structure IntroLeon Kim
 
lec02-data-models-sql-basics.pptx
lec02-data-models-sql-basics.pptxlec02-data-models-sql-basics.pptx
lec02-data-models-sql-basics.pptxcAnhTrn53
 
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH) Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH) David Fombella Pombal
 
So MANY databases, which one do I pick?
So MANY databases, which one do I pick?So MANY databases, which one do I pick?
So MANY databases, which one do I pick?kristinferrier
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Mudasir Qazi
 
Relational Model on Database management PPT
Relational Model on Database management PPTRelational Model on Database management PPT
Relational Model on Database management PPTssuser3e0f731
 

Similar a [Www.pkbulk.blogspot.com]dbms02 (20)

Databases for beginners.pdf
Databases for beginners.pdfDatabases for beginners.pdf
Databases for beginners.pdf
 
15 wordprocessing ml subject - fields and hyperlinks
15   wordprocessing ml subject - fields and hyperlinks15   wordprocessing ml subject - fields and hyperlinks
15 wordprocessing ml subject - fields and hyperlinks
 
Basics R.ppt
Basics R.pptBasics R.ppt
Basics R.ppt
 
Basics.ppt
Basics.pptBasics.ppt
Basics.ppt
 
[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03
 
603s129
603s129603s129
603s129
 
Apl – a programming language
Apl – a programming languageApl – a programming language
Apl – a programming language
 
PhillyR 18-19 Kickoff - Data Structure Intro
PhillyR 18-19 Kickoff - Data Structure IntroPhillyR 18-19 Kickoff - Data Structure Intro
PhillyR 18-19 Kickoff - Data Structure Intro
 
lec02-data-models-sql-basics.pptx
lec02-data-models-sql-basics.pptxlec02-data-models-sql-basics.pptx
lec02-data-models-sql-basics.pptx
 
04 pig data operations
04 pig data operations04 pig data operations
04 pig data operations
 
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH) Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
 
So MANY databases, which one do I pick?
So MANY databases, which one do I pick?So MANY databases, which one do I pick?
So MANY databases, which one do I pick?
 
23xml
23xml23xml
23xml
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
DB2 on Mainframe
DB2 on MainframeDB2 on Mainframe
DB2 on Mainframe
 
Xmll
XmllXmll
Xmll
 
Xml
XmlXml
Xml
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)
 
Relational Model on Database management PPT
Relational Model on Database management PPTRelational Model on Database management PPT
Relational Model on Database management PPT
 
Xml basics concepts
Xml basics conceptsXml basics concepts
Xml basics concepts
 

Más de AnusAhmad

[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexing[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexingAnusAhmad
 
[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13AnusAhmad
 
9. java server faces
9. java server faces9. java server faces
9. java server facesAnusAhmad
 
8. java script
8. java script8. java script
8. java scriptAnusAhmad
 
2. http, html
2. http, html2. http, html
2. http, htmlAnusAhmad
 
6. hibernate
6. hibernate6. hibernate
6. hibernateAnusAhmad
 

Más de AnusAhmad (19)

[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexing[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexing
 
[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11
 
[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10
 
[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09
 
[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07
 
[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06
 
[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04
 
[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01
 
[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13
 
9. java server faces
9. java server faces9. java server faces
9. java server faces
 
8. java script
8. java script8. java script
8. java script
 
7. struts
7. struts7. struts
7. struts
 
5. servlets
5. servlets5. servlets
5. servlets
 
4. jsp
4. jsp4. jsp
4. jsp
 
3. applets
3. applets3. applets
3. applets
 
2. http, html
2. http, html2. http, html
2. http, html
 
1. intro
1. intro1. intro
1. intro
 
6. hibernate
6. hibernate6. hibernate
6. hibernate
 

Último

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Último (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

[Www.pkbulk.blogspot.com]dbms02

  • 1. Lecture 2 - Relational Model 1 Fall 2001 Database Systems 1 Relational Model • In the relational data model – a database is a set of tables (with additional constraints, programs and interfaces) – a schema is the description of tables in a database – a relation or a table is a “set” of tuples – a tuple or a record is a mapping from a set of attributes to their values – an attribute is a slot for recording data, it has a name and a domain of applicable values – the schema of a table contains the table’s name and the attributes and the domain of the attributes Fall 2001 Database Systems 2 Example Database - Auction • OWNERS - people who sell items – Oid unique identifier given to them – Name their name – Email their e-mail address • ITEMS - the items sold by “owners” – Iid unique identifier of an item being sold – Oid the owner of the item – Name description of the item – Location location of the item • BUYERS - registered buyers allowed to bid on items – Buyid buyer identifier – Name buyer’s name – Email buyer’s e-mail address
  • 2. Lecture 2 - Relational Model 2 Fall 2001 Database Systems 3 Example Database - Auction • BIDS - people place bids on a specific item of a specific owner – Bid unique identifier of a bid – Date the date it was put online – Iid which item – Oid who owns the item – Buyid who placed the bid – Amount how much is the buyer bidding • Additional logic: – BIDS and ITEMS contain all the “unsold” items. As soon as an item is sold, it is deleted from bids and items. The loosing bidders are notified that they lost the item. Fall 2001 Database Systems 4  ¢¡¤£¦¥¨§¨©   £ ¥ ! #%$ (') 021 Smith@aol.com #¦3 4657198A@ Johns@geocities.com #B C9DE5GF8 Brown@netmail.com #IH PQDERTS Gray@microsoft.com UVXW(Y`¨a U9bTcde f¢gihqp Y¨hqg!d r sut vXwExAy Gray@microsoft,com €¨ ‚9ƒ„7…9†ˆ‡2‰ Robert432@aol.com €9 ‘uƒi’“”‰ Johns@somewhere.co m €7• ‘¨–7‰Aƒ“ Jj@yahoo.com €9— ˜Q™edA… Duke@jazz.com fegih¨jk f!lm nlm oqpqir setTuGpevGltew x9y z¦y {I|E}e~e€A ‚GƒT„ … †i‡TˆA}”‡| x9‰ z¦‰ Š6‹iƒeŒTeˆT…Geƒeˆ Ž ‡G„ …i7}2‘“’ ”i‡e€AˆA}E‡!| x• z¦‰ Š6‹iƒeŒTeˆT…Geƒeˆ Ž ‡G„ …i7}2‘“’ –qe— ˜u‡e2Œ ™7š ›¢œ !žeŸE A¡7¢E¢2¡ £6¤i¥ ¥¤G¦ ™§ ›qš ¨¨¤e©e©ª7« !ži¥ ¥¡i¬A¢T­ž® ¯ ¡7¤T¢”¢e¥¡ ™i° ›¦± !žeŸE A¡7¢E¢2¡ ²ižT¦A¢”ž® ³9´9µQ¶ ³u·¸ µX¹iº2» ´!· ¸ ¼¦· ¸ ³9½T¾!´i¸ ¿ÀqÁ7½7ÂGº ÃuÄ ÅuÆ Ç9È7É9Ê Ë!Æ Ì¦Æ ÃuÍ ÆÎÊ¨Ê ÃuÄ ÅuÍ Ç9È7É9Ê ËeÏ ÌÉ Ã¨Ð É9ʨÊ9Ê¨Ê ÃuÄ Å¨É Ç9È7ÉuÆ Ë!Æ Ì¦Æ ÃuÍ Æ”Í!Ê ÃuÄ Å!Ï Ñ9ÈiÆ ËiÒ ÌÉ Ã¨Ð ÍÏuÊ9Ê¨Ê ÃuÄ Å¨Ð Ñ9ÈiÆ Ë!Æ Ì¦Æ ÃuÍ Æ”Í¨Æ ÃuÄ ÅÒ Ñ9ÈiÍ ËeÏ ÌÉ Ã!Ï É¨Ð9Ê9Ê¨Ê ÃuÄ Å9Ó Ñ9ÈiÍ Ë!Í Ì¦Í ÃuÆ ÍÐ9Ê ÃuÄ ÅÇ Ñ9È7É Ë!Í Ì¦Í Ã¨É Í!ʨÊ
  • 3. Lecture 2 - Relational Model 3 Fall 2001 Database Systems 5 Attributes and Domains • Let D1 = the letter “O” followed by the set of all integers D2 = the set of all strings up to 30 characters that contain only letters A-Z,a-z D3 = the set of all strings that contain a single @ symbol, and a combination of Alphanumeric characters and “.”. Then, owners relation has schema Owners(OID:D1, Name:D2, Email:D3) Fall 2001 Database Systems 6 Attributes - Domains • All tuples in Owners come from – D1 × D2 × D3 – An example tuple: OID:O1, Name: ’Smith’, Email: ‘smith@aol.com’ – For any tuple: OID:v1, Name: v2, Email: v3 we have the property that v1 ∈ D1, v2 ∈ D2, v3 ∈ D3 • We usually abuse notation and assume an ordering for the attribute/domain pairs, and write the relation schema as: Owners(OID, Name, Email) and a tuple as: O1,’Smith’,’smith@aol.com ∈ Owners
  • 4. Lecture 2 - Relational Model 4 Fall 2001 Database Systems 7 More on domains • A domain is a type in the programming language sense • Domain values is a set of acceptable values for a variable of a given type. – Zipcode: zipcodeDomain = {11111, … ,99999}, – Grants: availableGrants = {50,000, … ,1,000,000} – Simple/Composite domains • Address = Street name+street number+city+province+ postal code • Domain compatibility – Binary operations (e.g., comparison to one another, addition, etc) can be performed on them. • Full support for domains is not provided in many current relational DBMSs Fall 2001 Database Systems 8 Relation Instances • A relation/table instance is a set of tuples with a specific schema (attribute/domain pairs) List form: OWNERS(OID,Name,Email) = { O1, Smith, smith@aol.com, O2, Johns, johns@geocities.com, O3, Brown, Brown@netmail.com, O4, Gray, Gray@microsoft.com } Tabular form: Ô Õ¤Ö¦×uب٠ÔÚ Û ÖÜiÝIÞ ×¨ÝqÜ!Ú ß à%á âäã¦åæAç Smith@aol.com à¦è é6êeç9ëTì Johns@geocities.com àí î!ïEêeðië Brown@netmail.com àIñ òQïEóAô Gray@microsoft.com
  • 5. Lecture 2 - Relational Model 5 Fall 2001 Database Systems 9 Relational Model Based on finite set theory: • First Normal Form Rule: all attributes take simple values - no set values are allowed. • Rows are accessed only by their content. The order of tuples does not have any meaning. • The order of columns does not have any specific meaning either. • No two tuples can have the same values for all the attributes, i.e. relations are sets. • Commercial systems allow duplicates (so bag semantics) Fall 2001 Database Systems 10 Keys • A superkey is a set of attributes that help uniquely identify a specific tuple – if no two owners may have the same Oid, then Oid is a superkey – if no two owners may have the same email address, then Email is a superkey • How about: – Oid + Name (together) for Owners? – Oid + Name (together) for ITEMS? – Iid + Oid (together) for ITEMS?
  • 6. Lecture 2 - Relational Model 6 Fall 2001 Database Systems 11 Keys • Given relation T, we use t[A1,…,Ak] to denote tuples with only attributes A1,…,Ak – for example, if t = O1, Smith, smith@aol.com then t[oid,name] = O1, Smith • Given a relation T with attributes {A1,…,Ak}, a key is a set of attributes {B1,…,Bm} ⊆ {A1,…,Ak} such that – if u and v are distinct tuples in relation T, then u[B1,…,Bm] and v[B1,…,Bm] are necessarily different from each other by user design! – no proper subset of {B1,…,Bm} has this property • Every table must have a unique primary key – Primary key is a key designated by the user and managed by the system Fall 2001 Database Systems 12 Null values • Attributes may be allowed to have null values because – a value does not exist for a tuple – a value exists, but it is not known – it is not known whether a value exists or not • Integrity rule: No column in a primary key can have null values