Professional Documents
Culture Documents
Relational DBMS: Motivating Questions
Relational DBMS: Motivating Questions
Relational DBMS: Motivating Questions
Motivating Questions
• From last time: Is MS Excel a DBMS?
Attributes
BUILDING
Build.num Street name Nb floors Value
412 Laurier 2 142000
Tuple 415 Laurier 3 167000
287 Ste-Foy 3 256000
288 Ste-Foy 2 195000
Values
• Domain constraints
• Primary keys
• Foreign keys
• Entity integrity
• Referential integrity
• Semantic integrity
• Principles:
– Defined for a database schema
– Must hold for every database instance
• Domain Integrity:
– All values for an attribute must be a value from the
attribute’s domain
– Must be a SINGLETON (atomic) value
(First-normal form)
A key is a set of columns that together makes each
row distinct
No two rows will have the same value of this key
(implies that no two rows are allowed to be identical)
A primary key is usually included as a single column
(e.g., ID)
Every relation has a key
Aplication :
– DBMS can check if the the tuple being inserted
matches an existing tuple on the attributes in the
key and disallow such insertions
– Similarly, a primary key should not contain a null
value since then it may not be possible to identify
some tuples
Foreign keys refer to primary keys in other tables
(e.g., Phys)
Foreign keys allow to represent relationships in
RDBMS
A referential integrity constraint from the attribute
Phys of Patient to Physicians means that Phys is a
foreign key that refers to the primary key of
Physicians
Physicians
ID Name Phone
Patient
If we keep a list of existing Physicians -
Physicians.ID = {1, 2, 3}, and have a referential
integrity constraint saying that every value of
Patient.Phys must also be a value of Physicians.Id
then we can reject the following request:
insert into Patient values (“15”, “Smith”, “1-01-98”, “15”);
• Entity Integrity:
– Must be able to distinguish two entities by their primary
key
– No primary key value may be NULL
– No restriction on non-primary key values
• Referential Integrity:
– A tuple containing a non-NULL foreign key must refer to
an existing tuple in the foreign relation
ID Name Age
Relational languages and DBMS are highly “non-
procedural”
Query describes table needed
DBMS figures out how to produce it
… but some queries are better than others
ambiguities
speed
computer system resources used
DBMS designers and implementers
Tool designers
Database administrator (DBA) I.e. ‘super-user’ for a database, similar to a
system administrator. DBA can define schemas, views, authorization,
indexes, tuning parameters, etc.
Application programmers
Database designers (interact with users to define database at all levels)
Operators and maintenance
End users
New applications -- Computer Aided Design and Manufacturing, Image
and graphic databases, geometric databases.
Relational model not very good for modeling data in these domains
Led to emergence of Object oriented database management systems. that
are designed to meet the requirements of these complex domains.
Key features:
– flexibility to meet the requirements of these domains without being
limited by data type and query language.
– power to designer to specify both structure of complex objects and
their behavior (operations)
• Review:
– What’s a RDBMS ?
– What’s a relation ?
– How are they represented in a DBMS?
– Where do these relations come from?
Is a spreadsheet a database?
Does MS Excel do all the functions of a database?
How?
Data definition
Data manipulation
Data security & integrity
Data recovery and concurrency
Data dictionary
Query optimization
The Nottingham Trent University - Department of Computing - C. Claramunt 27
RDBMS Product Examples
DBase:
– A standard for PC DBMS products, includes
– dBase language (std)
– browser
– application generator
– SQL
– and other tools
Paradox:
– Paradox language
– usual tools
– Front end for SQL db areas
Gupta SQLBase with SQL Windows :
– new kids on block (startup from other companies)
– good early reviews
– 1st client-server on PCs
– clean gateway to IBM’s DB2
– supports blobs, cursors
– good development environment
Microsoft SQL Server :
– fastest PC DBMS
– usual suite of tools
– extension of dBase language
Access :
– newest offering
– Visual Basic front end to SQL and usual tools
– Can read files from other PC DBMS vendors
– hot seller
Ingres :
– Descendant of Berkeley project (Postgres)
– still the most technically polished products, innovative
(e.g. in distributed DBMSs, rules)
– Good tools for DBA, application creation
Oracle and Sybase :
– Fairly technically advanced (early with client/server,
triggers)
– Major commercial SQL product
What is meant by relational database structure?
What are the minimal constraints ? Why do we need
them?
• What’s a relation again?
• How are they represented in a DBMS?
Foreign key
Primary key
(1) For each of the following tuples, states which, if any, of the integrity rules are
violated when they are added to the SALES_ORDER relation:
<14, 1/6/97, C45> <15, 1/7/97, null>
<16, 5/7/97, C52> <17, 10/7/98, null>