Professional Documents
Culture Documents
Text Book
Fundamentals of Database Systems,
R. Elmasri & S.B. Navathe
Pearson education, 2011.
Reference Books
1. Database Management Systems,
Raghu Ramakrishnan & Johannes Gehrke
Tata McGraw Hill, 2010.
2. Database System Concepts, Abraham Silberschatz,
Henry F. Korth & S. Sudarshan, Tata McGraw Hill, 2011.
3. Database Systems: Design, Implementation, and
Management, Peter Rob & Carlos Coronel, Cengage
Learning, 2011.
1
Relational database
• A relational database is a collection of tables.
• A table has column header and row.
• Every column header has a semantic.
2
An example of a relational database
3
Primary key of a table
4
Candidate key of a table
A candidate key consists of one or more column headers
that can uniquely identify rows of a table.
5
Foreign key of table
• A foreign key consists of one or more column headers
with the same data type as that of a primary key of the
same table or of a different table.
• Data type of foreign key must be the same as that of the
primary key.
• Foreign key refers to primary key
6
Foreign key
In a database, you may find a large number of
foreign keys.
7
Constraints
constraint = restriction
Domain constraint
data type defines domain constraint.
8
What is a database?
9
What is a database management system?
A database management system (DBMS) is a collection
of software programs that enable users to create and
maintain a database.
10
What is a database system?
Database system = Database + DBMS software
11
What is a database schema?
The description of a database is called database
schema.
12
Company database schema
EMPLOYEE(Fname, Minit, Lname, Ssn, Bdate, Address,
Gender, Salary, Super_ssn, Dno)
DEPT_LOCATIONS(Dnumber, Dlocation)
13
Company database schema containing data type
EMPLOYEE(Fname:string, Minit:char, Lname:string, Ssn:string,
Bdate:date, Address:string, Gender:char, Salary:real,
Super_ssn:string, Dno:char)
14
What is a schema diagram?
15
16
What is a schema construct?
17
Schema diagram of an Airline database
18
Identify foreign keys in the above schema
Library database schema diagram
19
Identify foreign keys in the above schema
Schema of a student database in a university
Write down the create table statements for the above schema.
20
Schema of a car database
Write down the create table statements for the above schema.
21
Schema diagram of company database
22
What is a database state?
23
Is it possible to change database schema?
25
We interact with database in our day-to-day life
through various activities
• Registering courses at the beginning of the semester
• Checking attendance status (almost everyday)
• Viewing results after term end examination
• Depositing / withdrawing money from bank
• Checking balance in your bank account
• Booking railway/airline ticket online
• Booking hotel room online
• Buying goods (books, apparel, footwear, mobile handset
and other things) online (from www.flipcart.com)
• Accessing www.youtube.com
26