Dbms Unit 1 Koushik
Dbms Unit 1 Koushik
Unit 1
Introduction to Database system: purpose of database system, view of data,
Independence, relational databases, -Database Language-Database System
architecture- levels, Mappings, Database, users and DBA Data Models: Importance,
Basic building blocks, Degrees of data abstraction. Database design and ER Model:
Overview, ER-Model, Constraints, ERDiagrams, ERD Issues, weak entity sets.
• Data is nothing but facts and statistics stored or free flowing over a
network, generally it's raw and unprocessed.
• For example: When you visit any website, they might store you IP
address, that is data, in return they might add a cookie in your browser,
marking you that you visited the website, that is data, your name, it's
data, your age, it's data.
• During early computer days, data was collected and stored on tapes,
which were mostly write-only, which means once data is stored on it,
it can never be read again. They were slow and bulky, and soon
computer scientists realised that they needed a better solution to this
problem.
• A DBMS is a software that allows creation, definition and manipulation of database, allowing users to store, process and
analyse data easily.
• DBMS provides us with an interface or a tool, to perform various operations like creating database, storing data in it,
updating data, creating tables in the database and a lot more.
• DBMS also provides protection and security to the databases. It also maintains data consistency in case of multiple users.
• It's Complexity
• Except MySQL, which is open source, licensed DBMSs are generally
costly.
• They are large in size.
• Components of DBMS
• The database management system can be divided into five major
components, they are:
• Hardware
• Software
• Data
• Procedures
• Database Access Language
• DBMS Components: Hardware
• When we say Hardware, we mean computer, hard disks, I/O channels
for data, and any other physical component involved before any data
is successfully stored into the memory.
• When we run Oracle or MySQL on our personal computer, then our
computer's Hard Disk, our Keyboard using which we type in all the
commands, our computer's RAM, ROM all become a part of the
DBMS hardware.
• DBMS Components: Software
• This is the main component, as this is the program which controls everything.
• The DBMS software is more like a wrapper around the physical database, which
provides us with an easy-to-use interface to store, access and update data.
• End User: These days all the modern applications, web or mobile, store user data. How do you think
they do it? Yes, applications are programmed in such a way that they collect user data and store the
data on DBMS systems running on their server. End users are the one who store, retrieve, update and
delete data.
Database Management Systems
Topic: Database Models
DBMS Database Models:
• A Database model defines the logical design and structure of a
database and defines how data will be stored, accessed and updated
in a database management system. While the Relational Model is the
most widely used database model, there are other models too:
• Hierarchical Model
• Network Model
• Entity-relationship Model
• Relational Model
Hierarchical Model
• This database model organises data into a tree-like-structure,
with a single root, to which all the other data is linked.
• The hierarchical starts from the Root data, and expands like a
tree, adding child nodes to the parent nodes.
• In this model, a child node will only have a single parent node.
• This model describes many real-world relationships like
example index of a book.
• In hierarchical model, data is organised into tree-like structure
with one-to-many relationship between two different types of
data, for example, one department can have many courses,
many professors and many students.
Hierarchical Model
E-R Model (Entity-relationship Model)
• ER Model describes the structure of a database with the help of a
diagram known as “Entity Relationship Diagram”
• The basic use of ER Model is to represent the structure of database
diagrammatically is called Er model
• An ER diagram shows the relationship among entity sets.
• Normally in database the data's are stored in Tables format.
• ER diagram shows the relationship between the tables.
• An entity set is a group of similar entities and these entities can have
attributes.
• Attributes are nothing but the columns in the table.
• ER diagram shows the complete “logical structures” of a database.
• ER diagrams has three main components:
Entity
Attribute
Relationship
1. Entity:
• An entity is as object or component of data.
• An entity is represented as “Rectangle” in an ER diagram.
• Example for entity:
STUDENT COLLEGE
• Weak Entity
• An entity that cannot be uniquely identified by its own attributes and relies
on the relationship with other entity is called “Weak Entity”
• Entity cannot be identified uniquely even though by its attribute. But it can be identified
by its relationship with other Entity is called “Weak Entity”
• An Week Entity is represented as “Double Rectangle” in an ER diagram
BANK ACCOUNT. No BANK
• Example:
Name Age
Student Address
State
Country
1 1
Person has Passport
• For example, a person has only one passport and a passport is given
to one person.
• One to Many relationship:
• When a single instance of an entity is associated with more than one
instance of another entity, then it is called “One to Many
relationship”.
1 M
Customer placed Order
• For example, a customer can place many orders but a order cannot
placed by many customer.
• Many to One relationship:
• When more than one instance of an entity is associated with single
instance of another entity, then it is called “Many to One
relationship”.
M 1
Student Study College
• For example, many student can study in a single college but a student
cannot study in many college at the same time.
• Many to Many relationship:
• When more than one instance of an entity is associated with more
than one instance of another entity, then it is called “Many to Many
relationship”.
M M
Student Assigned Project
• Derived attribute: These are the attributes which are not present in the whole
database management system, but are derived using other attributes. For
example, average age of students in a class.
Joining Course
Name Reg.No Marks Title
Date ID
Enroll
Student Course
ed
• Mapping Process:
• Create table for a relationship (that is for Enrolled)
• Add Primary Key of all participants entities as fields with respective
datatype.
• If relationship has any attribute , then add each attribute as field of a
table
• Declare Primary Key
• There are two entity and by declaring Primary Key in one entity, with
that Primary Key search in another entity that key will act as Foreign
key.
Relational Database Management System
(RDBMS)
• Relational model is a model in which data is maintained in a
table/Relation.
• Relational data base is most commonly used database. It contains
number of tables and each table has its own primary key.
• Due to a collection of organized set of table data can be accessed easily
in RDBMS.
• A table is a collection of related data entries and contain rows and
columns to store data.
• But a table can have duplicate tuples while a true relation cannot have
duplicate tuples.
What is a Table and Field/Column?
ID Name Age Course
1 AAA 21 Computer
2 BBB 22 Mathematics
3 CCC 24 Physics
4 DDD 25 Chemistry
Candidate Key
3. Super Key
• Super key is an attribute set that can uniquely identify a tuple. A super
key is a superset of a candidate key.