05_database_design_part_I
05_database_design_part_I
10/28/2024
Outline for Today’s Lecture
3
Spatialdatabases
Implementation
What Is a Relational Database Management System ?
4
courses
professors
Read ‘students.txt’
Read ‘courses.txt’
Find&update the record “Mary Johnson”
Find&update the record “CSE444”
Write “students.txt”
Write “courses.txt”
Problems without an DBMS...
9
connection
(ODBC, JDBC)
Database server
(someone else’s
C program) Applications
Data files
Functionality of a DBMS
11
Query engine
Storage management
Client-server architecture
Slow, cumbersome connection
But good for the data
Tables:
Students: Takes:
SSN Name Category SSN CID
123-45-6789 Charles undergrad 123-45-6789 CSE444
234-56-7890 Dan grad 123-45-6789 CSE444
… … 234-56-7890 CSE142
Courses: …
CID Name Quarter
CSE444 Databases fall
CSE541 Operating systems winter
Still implemented as files, but behind the scenes can
be quite complex
“data independence” = separate logical view
from physical implementation
Transactions
15
BEGIN TRANSACTION;
IF everything-went-OK
THEN COMMIT;
ELSE ROLLBACK
If system crashes, the transaction is still either committed or aborted
Transactions
16
sname
SELECT C.name
FROM Students S, Takes T, Courses C
WHERE S.name=“Mary” and
S.ssn = T.ssn and T.cid = C.cid cid=cid
sid=sid
name=“Mary”
Object-relational databases
Main memory database systems
XML XML XML !
Relational databases with XML support
Middleware between XML and relational databases
Native XML database systems
Lots of research here at UW on XML and databases
Data integration
Peer to peer, stream data management – still research
NoSQL
Big Data
Levels of Abstraction
Levels of Abstraction: Internal Level/Schema
Internal Level/Schema
The internal schema defines the physical storage structure of the database.
Facts about Internal schema:
The internal schema is the lowest level of data abstraction
It helps you to keeps information about the actual representation of the
entire database. Like the actual storage of the data on the disk in the form
of records
The internal view tells us what data is stored in the database and how
It never deals with the physical devices. Instead, internal schema views a
physical device as a collection of physical pages
Levels of Abstraction: Conceptual Schema/Level
Conceptual Schema/Level
The conceptual schema describes the Database structure of the whole database
for the community of users.
This schema hides information about the physical storage structures and focuses on
describing data types, entities, relationships, etc.
This logical level comes between the user level and physical storage view.
However, there is only single conceptual view of a single database.
Facts about Conceptual schema:
Defines all database entities, their attributes, and their relationships
Security and integrity information
In the conceptual level, the data available to a user must be contained in or
derivable from the physical level
Levels of Abstraction: External Schema/Level
24
External Schema/Level
An external schema describes the part of the database which specific user is interested in. It hides
the unrelated details of the database from the user. There may be "n" number of external views for
each database.
Each external view is defined using an external schema, which consists of definitions of various
types of external record of that specific view.
An external view is just the content of the database as it is seen by some specific particular user.
For example, a user from the sales department will see only sales related data.
Facts about external schema:
An external level is only related to the data which is viewed by specific end users.
This level includes some external schemas.
External schema level is nearest to the user
The external schema describes the segment of the database which is needed for a certain user
group and hides the remaining details from the database from the specific user group
Every user should be able to access the same data but able to see a
customized view of the data.
The user need not to deal directly with physical database storage
detail.
The DBA should be able to change the database storage structure
without disturbing the user's views
The internal structure of the database should remain unaffected when
changes made to the physical aspects of storage.
Inverted file model: A database built with the inverted file structure is
designed to facilitate fast full text searches. In this model, data content
is indexed as a series of keys in a lookup table, with the values
pointing to the location of the associated files.
Flat model: The flat model is the earliest, simplest data model. It
simply lists all the data in a single table, consisting of columns and
rows. In order to access or manipulate the data, the computer has to
read the entire flat file into memory, which makes this model inefficient
for all but the smallest data sets.
Inverted file model: A database built with the inverted file structure is
designed to facilitate fast full text searches. In this model, data content
is indexed as a series of keys in a lookup table, with the values
pointing to the location of the associated files.
Flat model: The flat model is the earliest, simplest data model. It
simply lists all the data in a single table, consisting of columns and
rows. In order to access or manipulate the data, the computer has to
read the entire flat file into memory, which makes this model inefficient
for all but the smallest data sets.
Degree: The total number of attributes which in the relation is called the
degree of the relation.
Cardinality: Total number of rows present in the Table.
Column: The column represents the set of values for a specific attribute.
Relation instance – Relation instance is a finite set of tuples in the RDBMS
system. Relation instances never have duplicate tuples.
Relation key - Every row has one, two or multiple attributes, which is called
relation key.
Attribute domain – Every attribute has some pre-defined value and scope
which is known as attribute domain
Domain constraints specify that within each tuple, and the value of
each attribute must be unique. This is specified as data types which
include standard data types integers, real numbers, characters,
Booleans, variable length strings, etc.
Key Constraints: An attribute that can uniquely identify a tuple in a
relation is called the key of the table. The value of the attribute for
different tuples in the relation has to be unique.
Modify allows you to change the values of some attributes in existing tuples.
Identify all the entities in the system. An entity should appear only
once in a particular diagram. Create rectangles for all entities and
name them properly.
Identify relationships between entities. Connect them using a line and
add a diamond in the middle describing the relationship.
Add attributes for entities. Give meaningful attribute names so they
can be understood easily.
The user requirements will be presented in a small report– max 4 pages with no
cover page. Page 1-3 : requirements and page 4: the ER diagram. Total submission
4 pages in PDF
Deadline Next Week. https://forms.gle/vzYg4iEBbjMKXWUu7
Felix Mutua, PhD