Upload
shreya-shah
View
12
Download
0
Tags:
Embed Size (px)
Citation preview
Introduction to Database Systems
P. M. Jat
23-07-2012 Database Systems 2
Talk Today?
Try to understand
What is Database?
What is Database Management System?
23-07-2012 Database Systems 3
Examples of DatabasesDatabase is “part of” most applications, around.Examples are-
Railway reservation – large dbContacts/Messages in your Mobiles – small dbEnterprise Database (Customer, Suppliers, Inventory, Ledger….)DAIICT SEGS, Library CollectionsYour mailbox, eBay, Amazon, JobsDBMore complex and Huge databases: facebook, YouTube
So, What is Database?
23-07-2012 Database Systems 4
What is Database ?
Simply a collection of data (values)
But, any random collection of data can not be a database.
Put simply, database is a collection of “related” “data”
23-07-2012 Database Systems 5
What is “Data” ?
Data can be defined as recordable facts that are used to describe an entity or object
For example for student: Name, DOB, email, cpi, courses done are recordable facts and have implicit meaning.
Normally information that can be derived from other data items, is not recorded in database; for example we do not store age, transcript, bank statement. Why?
23-07-2012 Database Systems 6
“Relatedness” of data in Database
Purpose of database dictates what is to be included in database and what is not to be included, and answer of “relatedness of data” comes from the purpose.
A data item is said to be related if it is needed in order to serve the purpose of building database
23-07-2012 Database Systems 7
“Relatedness” of data in Database
Some data appearing like related but may not be required in a database; for example medical history of an employee may not be included in Employee Database
If objective of database building is not to include medical history of employees, then it is unrelated; otherwise this could be related
All depends on purpose of building the database
23-07-2012 Database Systems 8
Example - Database
Consider keeping Academic records of students at DA-IICT.
Here, we have -Students, Courses, Semesters, Course-Offerings, Instructors, etc.In the beginning of semester, Student registers in courses offered in a semester, and finally earn gradesAt the end of semester, SPI is computed and CPI is updated accordingly
23-07-2012 Database Systems 9
StudentsStudent
23-07-2012 Database Systems 10
Courses
Course
23-07-2012 Database Systems 11
Course Offerings
CourseOffering
23-07-2012 Database Systems 12
Students Taking CoursesCourseRegisters
23-07-2012 Database Systems 13
What is Database?
Database is a collection of “related” “data”
23-07-2012 Database Systems 14
“Relatedness” of data in DatabaseElmasri/Navathe also gives a notion of “mini-real word” in order to understand “relatedness” of data – all data are said to be related if they represent “some mini real word”,
For example: Student academic record at DAIICT UG, or Admission Database at DA-IICT – purpose of building database decides – what is to be included
Some authors also use the term Enterprise for mini real word, i.e. database is a collection of data related to an “enterprise”, required to represent an enterprise
23-07-2012 Database Systems 15
Database Schema and Instance
A database has -Database SchemaDatabase Instance
Schema describes structures of database, while instance keeps actual data
What we have seen is an instance of Student-Acad-Records at DAIICT
23-07-2012 Database Systems 16
Database Schema - example
23-07-2012 Database Systems 17
Database Manipulation Operations
Below are few manipulation operations -Add a new student record – adds new row in student tableRegister a student in a course – adds new row in coursetakes tableRecord Grade in a course taken – modifies value of corresponding columnUpdate CPI of a student at the end of result processingList down students of 2009 batch having CPI >= 8.0
23-07-2012 Database Systems 18
Database Manipulation Operations in SQL
INSERT INTO STUDENT VALUE(‘201001123’, ‘Ankit’, …);
UPDATE REGISTERS SET GRADE = ‘AB’ WHERE STUDENT_ID = ‘201001123’ AND COURSE_NO = ‘IT321’ AND ACAD_YEAR = 2012;
SELECT * FROM STUDENTS WHERE CPI >=8.0 AND BATCH = 2009;
23-07-2012 Database Systems 19
Database Manipulation Operations
Manipulation operations work on database instance, and may change state of the database
What do we mean by state of database?
23-07-2012 Database Systems 20
Relational Model
Is an Implementation database model
In this model, Database is a set of tables
We perform database manipulation operations on tables using a standard query language called SQL
Database manipulation is performed in logical manner, and independent of how data are actually stored on disks and actually operations are performed.
23-07-2012 Database Systems 21
Database Management System
There is concept of Database Management System (DBMS)?
DBMS are based on a implementation model. For example for relational model, there is RDBMS. Oracle, MySQL, PostgreSQL, SQL-Server are popular commercial RDBMSes.
A list of various type of DBMS is found athttp://cs.fit.edu/~pbernhar/dbms.html
23-07-2012 Database Systems 22
Simplified DBMS architecture
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe
Considering a relational DBMS,
Try to understand howSQL operations shown in previous slides will beexecuted in this architecture
23-07-2012 Database Systems 23
DBMS enables
Data AbstractionData manipulation at logical levelEncapsulates efficient execution of operations
Self Description of Data – Database Schema is part of database in the form of metadata
Sharing of data and multi user transaction processing
23-07-2012 Database Systems 24
Reference/Source
Chapter 01 and 02Fundamentals of Database Systems, 5th ed., Ramez Elmasri and Shamkant B. Navathe, Pearson Education