Database Engineering
Unit 1
Introduction to DBMS
Application program examples
• Add new students, instructors, and courses
• Register students for courses, and generate class rosters
• Assign grades to students, compute grade point averages (GPA) and generate
transcripts
Schema and Instance
The customer Relation
The account relation
The depositor Relation
The branch relation
The loan relation
The borrower relation
Structure of Relational Databases
• A relational database consists of a collection of
tables, each of which is assigned a unique name .
• A row in a table represents a relationship among a
set of values.
• a table is a collection of such relationships
• each attribute, there is a set of permitted values,
called the domain of that attribute.
• the attribute branch-name, the domain is the set
of all branch names
• tuple variable t refer to the first tuple of the
relation.
• use the notation t[account-number] to denote the
value of t on the account-number attribute.
• t[account-number] = “A-101,” and t[branch-name] =
“Downtown”.
• the mathematical notation of t ∈ r to denote that
tuple t is in relation r.
• A1, A2, …, An are attributes
• R = (A1, A2, …, An ) is a relation schema
Example:
Customer_schema = (customer_name,
customer_street, customer_city)
• r(R) is a relation on the relation schema R
Example:
customer (Customer_schema)
Relation Instance
• The current values (relation instance) of a
relation are specified by a table
• An element t of r is a tuple, represented by a
row in a table
attributes
(or columns)
customer_name
customer_street
customer_city
Jones Main Harrison
Smith North Rye tuples
Curry North Rye (or rows)
Lindsay Park Pittsfield
Additional fundamental operation are
set intersection, natural join, division, and assignment.
• Ensure that unions are taken between compatible
relations.
• For valid union operation require that two
condition hold.
1.The relations r and s must be of the same arity. That is, they
must have the same number of attributes.
2. The
domains of the ith attribute of r and the ith attribute of s
must be the same for all .
• Query:
find the names of all customers who have a
loan at the Perryridge branch.
Answer:
σ (borrower x loan)
branch-name =“Perryridge”
Query:
• selection forcing equality on those attributes
that appear in both relation schemas, and
finally removes duplicate attributes