DBMS Unit-1
DBMS Unit-1
MANAGEMENT SYSTEM-
Database Management System
20A05401T-R20
Course Outcomes
After completion of the course, students will be able to
• Design a database for a real-world information system
• Define transactions that preserve the integrity of the database
• Generate tables for a database
• Organize the data to prevent redundancy
• Pose queries to retrieve the information from the database.
Syllabus:
Introduction: Database systems applications, Purpose of Database Systems, view of Data,
Database Languages, Relational Databases, Database Design, Data Storage and Querying,
Transaction Management, Database Architecture, Data Mining and Information Retrieval,
Specialty Databases, Database users and Administrators,
Introduction to Relational Model: Structure of Relational Databases, Database Schema,
Keys, Schema Diagrams, Relational Query Languages, Relational Operations
Introduction
What Is DATA?
Data can Be defined as Any (raw) facts about an object, that can be recorded in the form of
text, numbers, images, speech, audio, video … etc
Example: Student
Data or Attributes
What Is Information?
• Information is processing the data.
Example : Student
Information
What is Database
• It is a Collection of related data or Structured Information and it can be stored
Electronically in Computer System and Controlled by DBMS.
• Various types of Databases
– Traditional Database: Contains only Text & Numbers.
– Multimedia Database: Contains videos and audio, images….
– Geographical Info Database: Contains Satellite information
– Real Time Databases: product based databases such as Supermarket,
store…..
• Modes of Database
There are two modes in which databases are used.
– Online transaction processing: where a large number of users use the database.
– Data analytics: the processing of data to draw conclusions, and infer rules or
decision procedures, which are then used to drive business decisions.
Purpose of Database Systems
• To understand the purpose of database systems, consider part of a university
organization that, among other data, keeps information about all instructors, students,
departments, and course offerings.
• One way to keep the information on a computer is to store it in operating-system files.
SREC, Dept of CSE
DATABASE
MANAGEMENT SYSTEM-
• To allow users to manipulate the information, the system has a number of application
20A05401T-R20
programs that manipulate the files, including programs to:
• 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.
• Programmers develop these application programs to meet the needs of the university
• In the early days, database applications were built on top of file systems
• Drawbacks of using file systems to store data:
– Data redundancy and inconsistency
• Multiple file formats, duplication of information in different files
– Difficulty in accessing data
• Need to write a new program to carry out each new task
– Data isolation — multiple files and formats
– Integrity problems
• Integrity constraints (e.g. account balance > 0) become part of program
code
• Hard to add new constraints or change existing ones
Levels of Abstraction
• Physical level describes how a record (e.g., customer) is stored.
• Logical level: describes data stored in database, and the relationships among the data.
type customer = record
name : string;
street : string;
city : integer;
end;
• View level: application programs hide details of data types. Views can also hide
information (e.g., salary) for security purposes.
Database Languages
• Data Definition Language.
– Create, Alter, Drop and Truncate
• Data Manipulation Language.
– Insert, Update, Delete
• Data Retrieval Language .
– Select
• Data Transaction Control Language.
– Commit, Rollback and Save point
• Data Control Language.
– Grant and Revoke
• A database system provides a Data-definition language (DDL) to specify the database
schema and a Data-manipulation language (DML) to express database queries and
updates.
• In practice, the data-definition and data-manipulation languages are not two separate
languages; instead, they simply form parts of a single database language, such as the
SQL language.
Data-Definition Language
• We specify a database schema by a set of definitions expressed by a special language
called a data-definition language (DDL).
• The DDL is used to specify additional properties of the data.
Database Design
• Database design mainly involves the design of the database schema.
• The database designer or data model use the conceptual-Design to specify the data
requirements of the database users and how the database will be structured to fulfill
these requirements.
• conceptual-design provides a detailed overview of the enterprise.
• Database design can be generally defined as a collection of tasks or processes that
enhance the designing, development, implementation, and maintenance of enterprise
data management system. Designing a proper database reduces the maintenance cost
thereby improving data consistency
Relational Model
Customer-id Customer Customer Customer Account
Name street city Number
192-83-7465 Johnson Alma Palo Alto A-101
019-28-3746 Smith North Rye A-215
192-83-7465 Johnson Alma Palo Alto A-201
Example of tabular data in the relational model
321-12-3123
A Sample Relational Database Jones Main Harrison A-217
019-28-3746 Smith North Rye A-201
Database Architecture
Relational Database
• Figure 2.2 stores information about courses, consisting of a course id, title, dept name,
and credits, for each course.
• Figure 2.3 shows a third table, prereq, which stores the prerequisite courses for each
course.
• The table has two columns, course id and prereq id.
• Each row consists of a pair of course identifiers such that the second course is a
prerequisite for the first course.
Schema Diagrams
• A database schema, along with primary key and foreign-key constraints, can be
depicted by schema diagrams.
• Figure 2.9 shows the schema diagram for our university organization.
• Each relation appears as a box, with the relation name at the top in blue and the
attributes listed inside the box.
• Primary-key attributes are shown underlined.
• Foreign-key constraints appear as arrows from the foreign-key attributes of the
referencing relation to the primary key of the referenced relation.
• We use a two-headed arrow, instead of a single-headed arrow, to indicate a referential
integrity constraint that is not a foreign-key constraints.
Examples
• Select the tuples where department is physics from instructor.
• find all instructors with salary greater than $90,000.
• find the instructors in Physics with a salary greater than $90,000.
• find all departments whose name is the same as their building name.
Projection (P)
• Eliminates columns, then removes duplicates.
• Projection is denoted by the uppercase Greek letter pi (π).
• Notation: πA1,…,An (R)
• Example: project social-security number and names:
• πID, name, salary (instructor)