SlideShare a Scribd company logo
1
Introduction to Relational
Databases
Hugh Darwen
hugh@dcs.warwick.ac.uk
www.dcs.warwick.ac.uk/~hugh
CS252.HACD: Fundamentals of Relational Databases
Section 1: Introduction
2
Some Preliminaries
The theory taught in this part of the course was originally
devised by Edgar F. Codd in 1969. His seminal paper (1970)
was entitled A Relational Model of Data for Large Shared
Data Banks.
We will use a language called Tutorial D for examples and
exercises.
We will use Rel, an implementation of Tutorial D, for our on-
line work.
3
What Is a Database?
An organised, machine-readable collection
of symbols, to be interpreted as a true
account of some enterprise.
Machine-updatable, too …
… so a database is also a collection of variables.
A database is typically available to a community
of users, with possibly varying requirements.
4
“Organised Collection of
Symbols”
StudentId Name CourseId
S1 Anne C1
S1 Anne C2
S2 Boris C1
S3 Cindy C3
For example:
The symbols are organised into rows and columns, thus
forming a table. One of the rows is different in kind from the
others.
5
“To Be Interpreted as a True
Account”
StudentId Name CourseId
S1 Anne C1
For example (from the table just shown):
“Student S1, named Anne, is enrolled on course C1.”
Perhaps those green symbols, organised as they are with
respect to the blue ones, are to be understood to mean:
6
“Collection of Variables”
StudentId Name CourseId
S1 Anne C1
S1 Anne C2
S2 Boris C1
S3 Cindy C3
S4 Devinder C1
ENROLMENT is a variable. Perhaps the table we saw earlier
was once its value. If so, it (the variable) has been updated
since then (the row for S4 has been added).
ENROLMENT
7
What Is a Relational Database?
A database whose symbols are organised into a
collection of relations. Here is a relation, shown in
tabular form:
Might be the value currently assigned to ENROLMENT, a
relation variable (“relvar”).
StudentId Name CourseId
S1 Anne C1
S1 Anne C2
S2 Boris C1
S3 Cindy C3
S4 Devinder C1
8
“Relation” not equal to “Table”
This table is different from the one we have just seen,
but it represents the same relation:
Name StudentId CourseId
Devinder S4 C1
Cindy S3 C3
Anne S1 C1
Boris S2 C1
Anne S1 C2
In other words, the relation represented does not
depend on the order in which we place the rows or the
columns in the table.
9
Anatomy of a Relation
StudentId Name CourseId
S1 Anne C1
attribute name attribute values n-tuple, or tuple.
This is a 3-tuple.
The tuples
constitute the body
of the relation.
The number of
tuples in the body
is the cardinality of
the relation.
Heading (a set of attributes)
The degree of this heading is 3,
which is also the degree of the relation.
10
What Is a DBMS?
A piece of software for managing databases
and providing access to them.
A DBMS responds to imperatives (“statements”)
given by application programs, custom-written
or general-purpose, executing on behalf of users.
Imperatives are written in the database language
of the DBMS (e.g., SQL).
Responses include completion codes, messages and
results of queries.
11
What Does a DBMS Do?
Now, how does a relational DBMS do these things? …
• creates and destroys variables
• updates variables (honouring constraints and
authorisations)
• takes note of integrity rules (constraints)
• provides results of queries
• takes note of authorisations (who is allowed to do
what, to what)
• and more
In response to requests given by application programs:
12
Create and Destroy Variables
VAR ENROLMENT BASE RELATION
{ StudentId SID ,
Name CHAR,
CourseId CID }
KEY { StudentId, CourseId } ;
Creation (in Tutorial D):
Destruction:
DROP VAR ENROLMENT ;
13
Take Note of Integrity Rules
CONSTRAINT MAX_ENROLMENTS
COUNT ( ENROLMENT ) <= 20000 ;
E.g., can’t have more than 20,000 enrolments altogether. In
Tutorial D:
And if a constraint ceases to be applicable:
DROP CONSTRAINT MAX_ENROLMENTS ;
14
Take Note of Authorisations
PERMISSION U9_ENROLMENT FOR User9
TO READ ENROLMENT ;
E.g. (perhaps – but not in Tutorial D):
Permissions sometimes need to be withdrawn:
DROP PERMISSION U9_ENROLMENT ;
PERMISSION U8_ENROLMENT FOR User8
TO UPDATE ENROLMENT ;
15
Updates Variables
DELETE ENROLMENT WHERE StudentId =
SID ( ‘S4’ ) ;
E.g.:
UPDATE ENROLMENT WHERE StudentId =
SID ( ‘S1’ ) Name := ‘Ann’ ;
INSERT ENROLMENT
RELATION {
TUPLE { StudentId SID ( ‘S4’ ) ,
Name ‘Devinder’ ,
CourseId CID ( ‘C1’ ) } } ;
16
Provides Results of Queries
(ENROLMENT WHERE CourseId = CID(‘C1’))
{ StudentId, Name }
E.g.: Who is enrolled on course C1?
The result is another relation! In tabular form:
StudentId Name
S1 Anne
S2 Boris
S4 Devinder
17
EXERCISE
Consider this table:
A B A
1 2 3
4 5
6 7 8
9 9 ?
1 2 3
Give three reasons why it cannot be representing a relation.
18
IMPORTANT BIT OF ADMIN
Are you:
(a) an overseas student visiting for just one year, or
(b) doing a degree that is completely outside the CS
department? (In which case you should complete an
Unusual Option Form, obtainable from your dept secretary)
If so, on exit from this lecture:
Write your name, ITS userid, and course code on the sheet of
paper provided.
Otherwise you won’t get access to the software needed
for the Worksheets!

More Related Content

PPT
Relational dbms
PDF
an-introduction-to-relational-database-theory.pdf
PPT
603s129
PDF
RDBMS Model
PPT
Unit03 dbms
PPT
Dbms relational model
PPTX
Lecture-2 - Relational Model.pptx
PPT
Unit03 dbms
Relational dbms
an-introduction-to-relational-database-theory.pdf
603s129
RDBMS Model
Unit03 dbms
Dbms relational model
Lecture-2 - Relational Model.pptx
Unit03 dbms

Similar to RDB-fundamentals-1-intro.ppt (20)

PPTX
L4_Relational DatabasesDatabase Systems and Programming
PPTX
L4_Relational Databases Database Systems and Programming
PPT
Mca ii-dbms- u-iii-sql concepts
PPT
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
PPT
Ch3_Rel_Model-95.ppt
PPT
Database Technology Teaching Material For Learn
PDF
Bca examination 2015 dbms
PPTX
Relation Model Database Pertemuan k.pptx
PPTX
DBMS: Week 04 - Relational Model in a Database
PPT
Relational Database & Database Management System
PPTX
BCS403 DBMS MODULE-2 4th sem engineering.pptx
PPT
DBMS unit 3.ppt semester 4 btech aktu 2024
PPTX
Relational Model in DBMS detail explanation
PPTX
introduction to database system concepts 2
PDF
Lecture 02 ❘ Relational Data Model in Data Science.pdf
PPT
lecture5.ppt
PPTX
DBMS Module-2 notes for engineering BE vtu
PPTX
chapter_2_-_midterm__aik__daatabase.pptx
PPT
NMEC RD_UNIT 1.ppt
PDF
3_Relational_Model.pdf
L4_Relational DatabasesDatabase Systems and Programming
L4_Relational Databases Database Systems and Programming
Mca ii-dbms- u-iii-sql concepts
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Ch3_Rel_Model-95.ppt
Database Technology Teaching Material For Learn
Bca examination 2015 dbms
Relation Model Database Pertemuan k.pptx
DBMS: Week 04 - Relational Model in a Database
Relational Database & Database Management System
BCS403 DBMS MODULE-2 4th sem engineering.pptx
DBMS unit 3.ppt semester 4 btech aktu 2024
Relational Model in DBMS detail explanation
introduction to database system concepts 2
Lecture 02 ❘ Relational Data Model in Data Science.pdf
lecture5.ppt
DBMS Module-2 notes for engineering BE vtu
chapter_2_-_midterm__aik__daatabase.pptx
NMEC RD_UNIT 1.ppt
3_Relational_Model.pdf
Ad

More from THEFPS (12)

PPTX
Classification of Lipids By Danish Shafi MIr.pptx
PPTX
Types of Operating System
PPTX
1.3.6 Autoimmune disease.pptx
PPTX
OS powerpoint
PPTX
Super Computers
PPTX
Lecture 1.1.2-DNA(1).pptx
PPTX
Updated_rdbms-161216100344 (1).pptx
PPTX
RDBMS BY DANISH SHAFI MIR.pptx
PPTX
MICROBIOLOGY 22MBI20019_2.pptx
PPTX
lipidsu-160413072006.pptx
PPTX
Presentation.HTML.pptx
PPTX
Concept of Genes by Danish Shafi Mir 22MBI20005.pptx
Classification of Lipids By Danish Shafi MIr.pptx
Types of Operating System
1.3.6 Autoimmune disease.pptx
OS powerpoint
Super Computers
Lecture 1.1.2-DNA(1).pptx
Updated_rdbms-161216100344 (1).pptx
RDBMS BY DANISH SHAFI MIR.pptx
MICROBIOLOGY 22MBI20019_2.pptx
lipidsu-160413072006.pptx
Presentation.HTML.pptx
Concept of Genes by Danish Shafi Mir 22MBI20005.pptx
Ad

Recently uploaded (20)

PPTX
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
PPTX
Introduction to Fisheries Biotechnology_Lesson 1.pptx
PPTX
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
PDF
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
PDF
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
PDF
bbec55_b34400a7914c42429908233dbd381773.pdf
PPTX
Vitamins & Minerals: Complete Guide to Functions, Food Sources, Deficiency Si...
PPT
protein biochemistry.ppt for university classes
PPTX
ECG_Course_Presentation د.محمد صقران ppt
PDF
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
PDF
An interstellar mission to test astrophysical black holes
PPTX
Taita Taveta Laboratory Technician Workshop Presentation.pptx
PPTX
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
PPTX
2. Earth - The Living Planet Module 2ELS
PPTX
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
PPT
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
PPTX
Cell Membrane: Structure, Composition & Functions
PDF
diccionario toefl examen de ingles para principiante
PPTX
famous lake in india and its disturibution and importance
PDF
Phytochemical Investigation of Miliusa longipes.pdf
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
Introduction to Fisheries Biotechnology_Lesson 1.pptx
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
bbec55_b34400a7914c42429908233dbd381773.pdf
Vitamins & Minerals: Complete Guide to Functions, Food Sources, Deficiency Si...
protein biochemistry.ppt for university classes
ECG_Course_Presentation د.محمد صقران ppt
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
An interstellar mission to test astrophysical black holes
Taita Taveta Laboratory Technician Workshop Presentation.pptx
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
2. Earth - The Living Planet Module 2ELS
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
Cell Membrane: Structure, Composition & Functions
diccionario toefl examen de ingles para principiante
famous lake in india and its disturibution and importance
Phytochemical Investigation of Miliusa longipes.pdf

RDB-fundamentals-1-intro.ppt

  • 1. 1 Introduction to Relational Databases Hugh Darwen hugh@dcs.warwick.ac.uk www.dcs.warwick.ac.uk/~hugh CS252.HACD: Fundamentals of Relational Databases Section 1: Introduction
  • 2. 2 Some Preliminaries The theory taught in this part of the course was originally devised by Edgar F. Codd in 1969. His seminal paper (1970) was entitled A Relational Model of Data for Large Shared Data Banks. We will use a language called Tutorial D for examples and exercises. We will use Rel, an implementation of Tutorial D, for our on- line work.
  • 3. 3 What Is a Database? An organised, machine-readable collection of symbols, to be interpreted as a true account of some enterprise. Machine-updatable, too … … so a database is also a collection of variables. A database is typically available to a community of users, with possibly varying requirements.
  • 4. 4 “Organised Collection of Symbols” StudentId Name CourseId S1 Anne C1 S1 Anne C2 S2 Boris C1 S3 Cindy C3 For example: The symbols are organised into rows and columns, thus forming a table. One of the rows is different in kind from the others.
  • 5. 5 “To Be Interpreted as a True Account” StudentId Name CourseId S1 Anne C1 For example (from the table just shown): “Student S1, named Anne, is enrolled on course C1.” Perhaps those green symbols, organised as they are with respect to the blue ones, are to be understood to mean:
  • 6. 6 “Collection of Variables” StudentId Name CourseId S1 Anne C1 S1 Anne C2 S2 Boris C1 S3 Cindy C3 S4 Devinder C1 ENROLMENT is a variable. Perhaps the table we saw earlier was once its value. If so, it (the variable) has been updated since then (the row for S4 has been added). ENROLMENT
  • 7. 7 What Is a Relational Database? A database whose symbols are organised into a collection of relations. Here is a relation, shown in tabular form: Might be the value currently assigned to ENROLMENT, a relation variable (“relvar”). StudentId Name CourseId S1 Anne C1 S1 Anne C2 S2 Boris C1 S3 Cindy C3 S4 Devinder C1
  • 8. 8 “Relation” not equal to “Table” This table is different from the one we have just seen, but it represents the same relation: Name StudentId CourseId Devinder S4 C1 Cindy S3 C3 Anne S1 C1 Boris S2 C1 Anne S1 C2 In other words, the relation represented does not depend on the order in which we place the rows or the columns in the table.
  • 9. 9 Anatomy of a Relation StudentId Name CourseId S1 Anne C1 attribute name attribute values n-tuple, or tuple. This is a 3-tuple. The tuples constitute the body of the relation. The number of tuples in the body is the cardinality of the relation. Heading (a set of attributes) The degree of this heading is 3, which is also the degree of the relation.
  • 10. 10 What Is a DBMS? A piece of software for managing databases and providing access to them. A DBMS responds to imperatives (“statements”) given by application programs, custom-written or general-purpose, executing on behalf of users. Imperatives are written in the database language of the DBMS (e.g., SQL). Responses include completion codes, messages and results of queries.
  • 11. 11 What Does a DBMS Do? Now, how does a relational DBMS do these things? … • creates and destroys variables • updates variables (honouring constraints and authorisations) • takes note of integrity rules (constraints) • provides results of queries • takes note of authorisations (who is allowed to do what, to what) • and more In response to requests given by application programs:
  • 12. 12 Create and Destroy Variables VAR ENROLMENT BASE RELATION { StudentId SID , Name CHAR, CourseId CID } KEY { StudentId, CourseId } ; Creation (in Tutorial D): Destruction: DROP VAR ENROLMENT ;
  • 13. 13 Take Note of Integrity Rules CONSTRAINT MAX_ENROLMENTS COUNT ( ENROLMENT ) <= 20000 ; E.g., can’t have more than 20,000 enrolments altogether. In Tutorial D: And if a constraint ceases to be applicable: DROP CONSTRAINT MAX_ENROLMENTS ;
  • 14. 14 Take Note of Authorisations PERMISSION U9_ENROLMENT FOR User9 TO READ ENROLMENT ; E.g. (perhaps – but not in Tutorial D): Permissions sometimes need to be withdrawn: DROP PERMISSION U9_ENROLMENT ; PERMISSION U8_ENROLMENT FOR User8 TO UPDATE ENROLMENT ;
  • 15. 15 Updates Variables DELETE ENROLMENT WHERE StudentId = SID ( ‘S4’ ) ; E.g.: UPDATE ENROLMENT WHERE StudentId = SID ( ‘S1’ ) Name := ‘Ann’ ; INSERT ENROLMENT RELATION { TUPLE { StudentId SID ( ‘S4’ ) , Name ‘Devinder’ , CourseId CID ( ‘C1’ ) } } ;
  • 16. 16 Provides Results of Queries (ENROLMENT WHERE CourseId = CID(‘C1’)) { StudentId, Name } E.g.: Who is enrolled on course C1? The result is another relation! In tabular form: StudentId Name S1 Anne S2 Boris S4 Devinder
  • 17. 17 EXERCISE Consider this table: A B A 1 2 3 4 5 6 7 8 9 9 ? 1 2 3 Give three reasons why it cannot be representing a relation.
  • 18. 18 IMPORTANT BIT OF ADMIN Are you: (a) an overseas student visiting for just one year, or (b) doing a degree that is completely outside the CS department? (In which case you should complete an Unusual Option Form, obtainable from your dept secretary) If so, on exit from this lecture: Write your name, ITS userid, and course code on the sheet of paper provided. Otherwise you won’t get access to the software needed for the Worksheets!

Editor's Notes