Final - DBMS UNIT-1
Final - DBMS UNIT-1
Introduction
Unit: 1
Neeti Taneja
Designation: Assistant Professor(CSE Department)
NIET, Greater Noida
Qualification:
B.Tech(CSE) from SRMIET, Naraingarh ,Haryana affiliated
to
Kurukshetra University in 2011.
M.E(CSE) from Chitkara University, Rajpura,Punjab in 2015.
Pursuing PhD from Sharda University,Greater Noida.
Teaching Experience: 8 years
Research Publication
Particulars Journals
International 16
National Nil
Contd..
5. Modern tool usage: Create, select, and apply appropriate techniques, resources,
and modern engineering and IT tools including prediction and modeling to
complex engineering activities with an understanding of the limitations.
Contd..
9. Individual and team work: Function effectively as an individual, and as a
member or leader in diverse teams, and in multidisciplinary settings.
12. Life-long learning: Recognize the need for, and have the preparation and
ability to engage in independent and life-long learning in the broadest context
of technological change.
Program Specific
Outcomes
PSO1 PSO2 PSO3 PSO4
ACSE0506.1 3 1 3 1
ACSE0506.2 3 1 3 1
ACSE0506.3 3 1 3 1
ACSE0506.4 3 1 3 1
ACSE0506.5 3 1 3 1
AVG 3.00 1.00 3.00 1.00
SECTION – B CO
2. DDL stands for Data Definition Language. DML stands for Data
Manipulation Language. DDL statements are used to create
database, schema, constraints, users, tables etc. DML statement is
used to insert, update or delete the records.
What is Data?
What is Database?
The term ‘Database’ is made up of two separate words, i.e. Data and base
means database is a base of data.
Data Information
Information Knowledge
Knowledge Judgment
Judgment Decision
Decision Success
4. Integration of Data
When new constraints are added in file processing system, It is
difficult to change the program to enforce them, The problem is
compounded when constraint involve several data items from
different files.
Integrity constraints or consistency rules can be applied to database,
the constraints are such that it can be applied to data item within
a single record or it may be applied to relationships between
records.
5. Sharing of Data
In DBMS, data can be shared by authorized users of the organization.
The database administrator manages the data and gives rights to
users to access the data. Many users can be authorized to access the
same piece of information simultaneously. The remote users can
also share the same data. Similarly, the data of same database can
be shared between different application programs.
6. Atomicity Problem
In many applications , It is crucial that if failure occur, the data is
restored to the consistent state that existed prior to the failure.
Atomicity means:- either all or not at all.
9. Data Independence
The separation of data structure of database from the application program
that uses the data is called data independence. In DBMS, you can easily
change the structure of database without modifying the application
program.
2. What is a database?
a) Organized collection of information that cannot be
accessed, updated, and managed
b) Collection of data or information without organizing
c) Organized collection of data or information that can be
accessed, updated, and managed
d) Organized collection of data that cannot be updated
I. Data
II. Hardware
III. Software
IV. Users
• View level: application programs hide details of data types. Views can
also hide information (such as an employee’s salary) for security purposes.
Schema
A database schema is the skeleton structure that represents the logical
view of the entire database.
It is not expected to change frequently.
When we define a new database we specify its database schema.
It defines how the data is organized and how the relations among them
are associated.
It formulates all the constraints that are to be applied on the data.
Example:
Physical schema:
Relations stored as unordered files.
Index on first column of Students.
Conceptual schema:
Students(sid: string, name: string, login: string, age: integer, gpa:real)
Courses(cid: string, cname:string, credits:integer)
Enrolled(sid:string, cid:string, grade:string)
External Schema (View):
View1- Course_info(cid:string,enrollment:integer)
View2-studeninfo(id:int. name:string)
1. Which of the following is known as a set of entities of the same type that
share same properties, or attributes?
a) Relation set
b) Tuples
c) Entity set
d) Entity Relation model
These commands are used to update the database schema that's why
they come under Data definition language.
• TCL is used to run the changes made by the DML statement. TCL can
be grouped into a logical transaction.
They provide the interface between the low-level data stored in the database
and application programs and queries submitted to the system.
• Buffer Manager : It is responsible for fetching data from disk storage into
main memory and deciding what data to cache in memory.
1. Data Model gives us an idea that how the final system will look like
after its complete implementation.
2. It defines the data elements and the relationships between the data
elements.
In above example , Company is the parent and rests of them are its
children. Department has employees and projects as its children and so
on. This type of data modeling is called hierarchical data model.
One company has multiple departments (1:N), one company has multiple
suppliers (1:N),one department has multiple employees (1:N), each
department has multiple projects(1:N)
Since records are grouped under related table, it solves the flat file
redundancy issue. But look at the many to many relationship examples
given above. In such case, we have to store same project information for
more than one department. This is duplication of data and hence a
redundancy. So, this model does not reduce the redundancy issue to a
significant level.(M:M)
Let us revisit our company example. A company has different projects and
departments in the company own those projects. Even suppliers of the
company give input for the project.
Here Project has multiple parents and each department and supplier have
multiple projects.
1. The ability to query data, as well as insert, delete, and alter tuples, is
offered by ____________
a) TCL (Transaction Control Language)
b) DCL (Data Control Language)
c) DDL (Data Definition Langauge)
d) DML (Data Manipulation Langauge)
2. One of the major goals of Object relational data model is to close the
gap between relational databases and the object oriented practises
frequently used in many programming languages such as C++, C#, Java
etc.
3. Be able to write SQL statements that edit existing data. Be able to write
SQL statements that create database objects.
• An entity set is a set of entities of the same type that share the
same properties.
– Example: set of all persons, companies, trees, holidays
– Unary Relationship
– Binary Relationship
– n-ary Relationship
• When each entity in each entity set can take part only once in the
relationship, the cardinality is one to one. Let us assume that a male
can marry to one female and a female can marry to one male. So
the relationship will be one to one.
• When entities in one entity set can take part only once in the
relationship set and entities in other entity set can take part more
than once in the relationship set, cardinality is many to one
• When entities in all entity sets can take part more than once in the
relationship cardinality is many to many. Let us assume that a
student can take more than one course and one course can be
taken by many students. So the relationship will be many to many.
Here,
• One student can enroll in at most one course.
• One course can be enrolled by at most one student.
11/04/2023 Neeti Taneja DBMS Unit-1 125
Keys Example
Primary Key
Customers
Here are some reasons for using SQL key in the DBMS system.
• Keys help you to identify any row of data in a table.
• In a real-world application, a table could contain thousands of
records. Moreover, the records could be duplicated.
• Keys in RDBMS ensure that you can uniquely identify a table record
despite these challenges.
• Allows you to establish a relationship between and identify the
relation between tables
• Help you to enforce identity and integrity in the relationship.
There are mainly Eight different types of Keys in DBMS and each key
has it’s different functionality:
– Super Key – A super key is a group of single or multiple keys
which identifies rows in a table.
– Primary Key – is a column or group of columns in a table that
uniquely identify every row in that table.
– Candidate Key – is a set of attributes that uniquely identify
tuples in a table. Candidate Key is a super key with no
repeated attributes.
– Alternate Key – is a column or group of columns in a table that
uniquely identify every row in that table.
• Candidate key Example: In the given table Stud ID, Roll No, and
email are candidate keys which help us to uniquely identify the
student record in the table.
Helps you to uniquely identify a record in It is a field in the table that is the primary
the table. key of another table.
You can have the single Primary key in a You can have multiple foreign keys in a
table. table.
Q. Which type of entity cannot exist in the database unless another type
of entity also exists in the database, but does not require that the
identifier of that other entity be included as part of its own identifier?
5. Weak entity
6. Strong entity
7. ID-dependent entity
8. ID- independent entity
11/04/2023 Neeti Taneja DBMS Unit-1 143
Topic- Generalization, Specialization and
Aggregation Objective
2. Specialization helps in defining the set of subclasses of the entity type. Also,
it helps in establishing extra specific attributes with all subclasses and added
specific relationship types between each subclass and the other entity types
or the other subclasses.
•
11/04/2023 Neeti Taneja DBMS Unit-1 156
RULE-05 (contd..)
NOTE- Here, combined table will be drawn for the entity set B and
relationship set R.
11/04/2023 Neeti Taneja DBMS Unit-1 158
RULE-05 (contd..)
NOTE- Here, combined table will be drawn for the entity set A and
relationship set R.
• Here, two tables will be required. Either combine ‘R’ with ‘A’ or ‘B’
• Way-01:
1. AR ( a1 , a2 , b1 )
2. B ( b1 , b2 )
• Way-02:
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
1. https://www.geeksforgeeks.org/last-minute-notes-dbms/
2. https://www.geeksforgeeks.org/quiz-corner-gq/#DBMS%20Mock%20Tests
3. https://www.geeksforgeeks.org/commonly-asked-dbms-interview-questio
ns/
4. https://www.geeksforgeeks.org/commonly-asked-dbms-interview-questio
ns-set-2/
• http://www.aktuonline.com/papers/btech-cs-5-sem-data-base-man
agement-system-KCS501-2020.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-man
agement-system-KCS-501-2018-19.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-man
agement-system-ncs-502-2017-18.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-man
agement-system-ncs-502-2016-17.pdf