Download Terminology - Midlands State University

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Serializability wikipedia , lookup

IMDb wikipedia , lookup

DBase wikipedia , lookup

Microsoft Access wikipedia , lookup

Oracle Database wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Concurrency control wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Functional Database Model wikipedia , lookup

PL/SQL wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Ingres (database) wikipedia , lookup

SQL wikipedia , lookup

Clusterpoint wikipedia , lookup

Database wikipedia , lookup

Relational algebra wikipedia , lookup

Database model wikipedia , lookup

Relational model wikipedia , lookup

Transcript
Relational Model
It is concerned with three principal aspects of data
A relational model has 3 main aspects:
i) Structural aspect: the data in the database is perceived by the user as tables and nothing
else but tables
Each table has a heading or defintion part and a body or content part. The heading part consists
of the table name and the column names for example a student table may have columns such as
degree programme, level, GPA etc. The body shows the rows of the table with each row
representing a student enrolled at a university and a row may have more than 30 000 rows.
There is also need to understand the connections or relationships among tables. Rows in a table
are usually related to rows in other tables with the matching or identical values showing
relationships between tables. Consider the tables below:
Student
Std Reg No
Std Name
123-45-6789
Wells
124-56-7890
Kendall
Offering
OfferNo
CourseNo
1234
IS320
4321
IS320
Enrollment
Std Reg No
OfferNo
123-45-6789
1234
124-56-7890
4321
ii) Integrity Aspect: these tables satisfy certain integrity constraints( to be discussed in
later chapters)
To ensure that a database provides meaningful information, integrity rules are necessary. The
two important integrity rules are entity integrity and referential integrity.
iii) Manipulative Aspect: the operators available to the user for manipulating those tables for
example for the purposes of data retrieval (operators that derive tables from tables) Of
those operators there are three particularly important ones which are restrict, project
and join
In order to implement a DBMS, there must exist a set of rules which state how
the database system will behave. For instance, somewhere in the DBMS must
be a set of statements which indicate than when someone inserts data into a
row of a relation, it has the effect which the user expects. One way to specify
this is to use words to write an `essay' as to how the DBMS will operate, but
words tend to be imprecise and open to interpretation. Instead, relational
databases are more usually defined using Relational Algebra.
Relational Algebra is :
 the formal description of how a relational database operates
 an interface to the data stored in the database itself
 the mathematics which underpin SQL operations
Operators in relational algebra are not necessarily the same as SQL operators, even if they have
the same name. For example, the SELECT statement exists in SQL, and also exists in relational
algebra. These two uses of SELECT are not the same. The DBMS must take whatever SQL
statements the user types in and translate them into relational algebra operations before
applying them to the database.
Terminology





Relation - a set of tuples.
Tuple - a collection of attributes which describe some real world entity.
Attribute - a real world role played by a named domain.
Domain - a set of atomic values.
Set - a mathematical definition for a collection of objects which contains no duplicates.
Introduction to Relational Algebra
*Before going on, this tutorial assumes you already have a basic understanding of
the structure of relational databases.
Relational algebra is a procedural query language, which consists of a set of operations that
take one or two relations as input and produce a new relation as their result. The fundamental
operations that will be discussed in this tutorial are: select, project, union, and set difference.
Besides the fundamental operations, the following additional operations will be discussed: setintersection.
Each operation will be applied to tables of a sample database. Each table is otherwise known
as a relation and each row within the table is refered to as a tuple. The sample database
consists of tables in which one might see in a bank. The sample database consists of the
following 6 relations:
The account relation
branch-name
Downtown
Mianus
Perryridge
Round Hill
Brighton
Redwood
Brighton
The branch relation
account-number
A-101
A-215
A-102
A-305
A-201
A-222
A-217
balance
500
700
400
350
900
700
750
branch-name
branch-city
assets
Downtown
Redwood
Perryridge
Mianus
Round Hill
Pownal
North Town
Brooklyn
Palo Alto
Horseneck
Horseneck
Horseneck
Bennington
Rye
9000000
2100000
1700000
400000
8000000
300000
3700000
Brighton
The customer relation
customer-name
Jones
Smith
Hayes
Curry
Lindsay
Turner
Williams
Adams
Johnson
Glenn
Brooks
Green
The depositor relation
Brooklyn
7100000
customer-street
Main
North
Main
North
Park
Putnam
Nassau
Spring
Alma
Sand Hill
Senator
Walnut
customer-name
customer-city
Harrison
Rye
Harrison
Rye
Pittsfield
Stamford
Princeton
Pittsfield
Palo Alto
Woodside
Brooklyn
Stamford
account-number
Johnson
Smith
Hayes
Turner
Johnson
Jones
Lindsay
The loan relation
A-101
A-215
A-102
A-305
A-201
A-217
A-222
branch-name
loan-number
Downtown
Redwood
Perryridge
Downtown
Mianus
Round Hill
Perryridge
L-17
L-23
L-15
L-14
L-93
L-11
L-16
amount
1000
2000
1500
1500
500
900
1300
The borrower relation
customer-name
loan-number
Jones
L-17
Smith
L-23
Hayes
L-15
Jackson
L-14
Curry
L-93
Smith
L-11
Williams
L-17
Adams
L-16
Throughout the tutorial, each of these relations can be viewed by clicking on the "Database"
link available at the top and bottom of each page and then selecting the specific relation from
the resulting pop-up window.
Select an operation on the left to begin the tutorial.