You are on page 1of 10

GRADE-XII

SUBJECT: COMPUTER SCIENCE (COM.332)

UNIT 1:

DATABASE MANAGEMENT SYSTEM (DBMS)

1.1 introduction to Data, Database, Database System, DBMS:


Data:
Data is defined as raw facts or figures, or information that's stored in or used by a computer.
It may or may not give any sense. An example of data is information collected for a research
paper. The main examples of data are weights, prices, numbers of items sold, employee
names, product names, addresses etc.
Information: - The processed data which gives complete meaning is called information.
Information is organized or classified data, which has some meaningful values for the
receiver. Information is the processed data on which decisions and actions are based.
For the decision to be meaningful, the processed data must qualify for the following
characteristics −
 Timely − Information should be available when required.
 Accuracy − Information should be accurate.
 Completeness − Information should be complete.
Database:
A database is an organized collection of structured information, or data, typically stored
electronically in a computer system. Database gives very useful information for an organization
during data manipulation and decision making. It provides a base or information for managing
large volume of data in well-organized manner. The data can then be easily accessed, managed,
modified, updated, controlled, and organized. Most databases use structured query language
(SQL) for writing and querying data.
Example: - Data of Result Sheet, Telephone Diary, Customer Records and Price List etc.

Database Management System (DBMS):


A database management system is a software that defines, manipulates and manages the
database. It acts as the backbone of a database.
The software which is used to manage database is called Database Management System (DBMS).
For Example: MS Access, MySQL, MySQL Server, Oracle etc. are popular commercial DBMS
used in different applications. DBMS allows users the following tasks:
Data Definition: It helps in creation, modification and removal of definitions that define the
organization of data in database.
Data Updating: It helps in insertion, modification and deletion of the actual data in the database.
Data Retrieval: It helps in retrieval of data from the database which can be used by applications
for various purposes.
1.2 Field, Record, Objects, Primary Key, Alternate Key, Candidate Key
Field: A field is the property or attributes of a Table. Examples: S.N., NAME and PHONE NO
are fields in the below Table.
A database field is a set of data values, of the same data type, in a table.

S.N. NAME PHONE NO


101 ABC College 01-553455
102 BBB College 01-441236
103 AAA College 01-439780

Record: - A collection of interrelated fields is called record. A single row containing of one
college data is a record. A database record is collection of fields about the same person, item, or
object in a database. A record is a group of data saved in a table.
Record as shown below.

102 BBB College 01-441236

Table: A table is the arrangement of rows and columns. Each table must have unique name. A
row defines a record and a column defines a field in a table.
Objects:
A database object is any defined object in a database that is used to store or reference data.
Anything which we make from create command is known as Database Object. It can be used
to hold and manipulate the data. Some of the examples of database objects are Tables, Forms,
Reports, View, Sequence, Indexes etc.
 Table – Basic unit of storage; composed rows and columns
 View – Logically represents subsets of data from one or more tables
 Sequence – Generates primary key values
 Index – Improves the performance of some queries
 Synonym – Alternative name for an object
Primary Key
A primary key is the column or columns that contain values that uniquely identify each row
in a table. A table cannot have more than one primary key. A primary key is a special relational
database table column (or combination of columns) designated to uniquely identify each table
record.
A primary key’s main features are:
 It must contain a unique value for each row of data.

 It cannot contain null values.

 Every row must have a primary key value.

In the table, Stud-ID is an example of Primary Key.


Alternate Key
It is a column or group of columns in a table that uniquely identify every row in that table. A table
can have multiple choices for a primary key but only one can be set as the primary key. All the
keys which are not primary key are called an Alternate Key.
In this table, Stud-ID, Roll No, Email are qualified to become a primary key. But since Stud-ID
is the primary key, Roll No, Email becomes the alternative key.

Stud-ID Roll No First Name Last Name Email

1 11 Ram Nath abc@gmail.com

2 12 Hari Sharma xyz@gmail.com

3 13 Dhana Shakya mno@yahoo.com

Candidate Key
It is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super key with
no repeated attributes. The Primary key should be selected from the candidate keys. Every table
must have at least a single candidate key. A table can have multiple candidate keys but only a
single primary key.
Properties of Candidate key:
 It must contain unique values

 Candidate key may have multiple attributes

 Must not contain null values

 It should contain minimum fields to ensure uniqueness

 Uniquely identify each record in a table

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.
1.3 Advantages of using DBMS

Advantages of DBMS:
1. Data Abstraction
 Data abstraction means, to hide the complexity of data from the basic users.
 DBMS abstracts the data from the users, which is not useful for the users. It shows only
those data which are useful to the users.

2. Controlling Data Redundancy

 Data redundancy means having multiple copies of the same data.


 DBMS controls the data redundancy and integrates all data into a single database file.
 Controlling the data redundancy also helps to save our storage space and increase retrieval
and update speed.
3. Minimized Data inconsistency

 Data inconsistency means that different files may contain different information about a
particular object or person.
 If DBMS has reduced the data redundancy then the database system leads the better data
consistency.
 Our data items appear only once (no redundancy) so the updated values are immediately
available to all users.

4. Data Manipulation Easily

 In DBMS, Data can be manipulated easily, because data is centralized so once the data
structure is defined, we can easily change in the data like- insertion, modification, or
deletion.

5. Data can be shared

 Data can be shared easily by multiple applications in centralized DBMS. The applications
can be developed without having to create any new stored files.
 The DBMS helps to develop a friendly environment where end-users can access and
manage data.

6. Data Security

 DBMS provides data security means protecting your precious data from unauthorized
access. Data can be access only by authorized users of the organization.
 A database can be accessed only by proper authentication usually by verifying login and
password.

7. Support Multi-users Views

 Multi-users can view the data at the same time.


 Using the database, many users can access the data at the same time which increases our
working speed.
 DBMS gives the ability for its multiple authorized users to access the same database from
different locations, in different ways, to complete its different works.

8. Concurrent Access

 Several users can access the database concurrently.

9. Helps for Decision Making

 Better organized data and improved data access give us better quality information which
helps for making better decisions.

Disadvantages of DBMS:

1. Cost of Hardware and Software

To run the DBMS software, we need a high-speed processor and a large memory size is
required which causes expensive hardware is needed.
2. Cost of Data Conversion

When a computer file-based system is replaced with a database system, then the data stored in
data files must be converted into database files. It is the difficult and time-consuming method to
convert the data of data files into database

3. Cost of Staff Training

DBMS are often complex systems, so training is required for the users to use the DBMS. The
organization has to be paid plenty of amount for the training of workers to run the database
management system.

4. Frequent Upgrade/Replacement Cycles


DBMS vendors frequently upgrade their products by adding new functionality. Such new
features often come bundled in new upgrade versions of the software. Some of these versions
require hardware upgrades. Not only do the upgrades themselves cost money, but it also costs
money to train database users and administrators to properly use and manage the new features.

1.4 DDL (Data Definition Language) and DML (Data Manipulation Language)
Database Language
Database languages can be used to read, store and update the data in the database. Structured
Query Language (SQL) as we all know is the database language by the use of which we can
perform certain operations on the existing database and also we can use this language to create
a database. SQL uses certain commands like Create, Drop, Comments and Insert etc. to carry
out the required tasks.

Types of Database Language:


1. DDL – Data Definition Language: It is used to define database structure or pattern.
2. DML – Data Manipulation Language: It is used for accessing and manipulating
data in a database. It handles user requests.

3. DCL – Data Control Language: It is used to retrieve the stored or saved data.
4. TCL – Transaction Control Language: TCL is used to run the changes made by the
DML statement. TCL can be grouped into a logical transaction.
DDL (Data Definition Language): It is used to define database structure or pattern. DDL
actually consists of the SQL commands that can be used to define the database schema. It simply
deals with descriptions of the database schema and is used to create and modify the structure of
database objects in the database.

Examples of DDL commands:


 CREATE– is used to create the database or its objects (like table, index, function, views
etc.).
 DROP– is used to delete objects from the database.
 ALTER-is used to alter the structure of the database.
 TRUNCATE–is used to remove all records from a table, including all spaces allocated for
the records are removed.
 COMMENT –is used to add comments to the data dictionary.
 RENAME –is used to rename an object existing in the database.

DML (Data Manipulation Language): It is used for accessing and manipulating data in a
database. It handles user requests. The SQL commands that deals with the manipulation of data
present in the database belong to DML and this includes most of the SQL statements.

Examples of DML commands:


 INSERT- is used to insert data into a table.
 UPDATE- is used to update existing data within a table.
 DELETE- is used to delete records from a database table.

 SELECT-It is used to retrieve data from a database.


 MERGE-It performs UPSERT operation, i.e., insert or update operations.

#Differentiate between DDL and DML

SN Key DDL DML

Stands for DDL stands for Data Definition DML stands for Data Manipulation
1
Language. Language.

Usage DDL statements are used to create DML statement is used to insert, update
2 database, schema, constraints, users, or delete the records.
tables etc.

Classification DDL has no further classification. DML is further classified into procedural
3
DML and non-procedural DML.

Commands CREATE, DROP, RENAME and INSERT, UPDATE and DELETE.


4
ALTER.

1.5 Database Model: Network Model, Hierarchical Model and Relational Database
Model
A Database model is a data model that defines the logical design and structure of a database and
defines how data will be stored, accessed and updated in a database management system. There
are different types of database model among them Relational database Model is the most widely
used database model.

Types of database model

1. Hierarchical Model

2. Network Model

3. Entity-relationship Model

4. Relational database Model


Hierarchical Model

Hierarchical Model was the first DBMS model. This model organizes the data in the hierarchical
Tree Structure. The hierarchy starts from the root which has root data and then it expands in
the form of a tree adding child node to the parent node. This model easily represents the real-
world relationships like food recipes, sitemap of a website etc.
Example: We can represent the relationship between the shoes present on a shopping website
in the following way:

Features of a Hierarchical Model

1. One-to-many relationship: Here, data is organized in a tree-like structure where the


one-to-many relationship is between the data types. Also, there can be only one path
from parent to any node. Example: In the above example, if we want to go to the
node sneakers we only have one path to reach there i.e. through men's shoes node.
2. Parent-Child Relationship: Each child node has a parent node but a parent node can
have more than one child node. Multiple parents are not allowed.
3. Deletion Problem: If a parent node is deleted then the child node is automatically
deleted.
4. Pointers: Pointers are used to link the parent node with the child node and are used to
navigate between the stored data. Example: In the above example the 'shoes' node points
to the two other nodes 'women shoes' node and 'men's shoes' node.
Advantages of Hierarchical Model

 It is very simple and fast to traverse through a tree-like structure.


 Any change in the parent node is automatically reflected in the child node so, the
integrity of data is maintained.
Disadvantages of Hierarchical Model

 Complex relationships are not supported.


 It does not support more than one parent of the child node so if we have some complex
relationship where a child node needs to have two parent node then that can't be
represented using this model.
 If a parent node is deleted then the child node is automatically deleted.
Network Model
This model is an extension of the hierarchical model. It was the most popular model before the
relational model. This model is the same as the hierarchical model, the only difference is that a
record can have more than one parent. It replaces the hierarchical tree with a Graph.

Example: In the example below we can see that node student has two parents i.e. CSE
Department and Library. This was earlier not possible in the hierarchical model.

Features of a Network Model

1. Ability to merge more Relationships: In this model, there are more relationships so
data is more related. This model has the ability to manage one-to-one relationships as
well as many-to-many relationships.
2. Many paths: There are more relationships so there can be more than one path to the
same record. This makes data access fast and simple.
Advantages of Network Model
 This model is more flexible due to many to many relationship.
 The data can be accessed faster as compared to the hierarchical model.
 There is a parent-child relationship so data integrity is present. Any change in parent
record is reflected in the child record.
Disadvantages of Network Model
 It is very complex type of database model.
 It is difficult to handle the relationship in complex programs.
 Any change like updation, deletion, insertion is very complex.//////

Entity-Relationship Model

Entity-Relationship Model(ER Model) is a high-level data model diagram. In this model, we


represent the real-world problem in the pictorial form to make it easy for the stakeholders to
understand. It is also very easy for the developers to understand the system by just looking at
the ER diagram. We use the ER diagram as a visual tool to represent an ER Model. ER diagram
has the following three components:

 Entities: Entity is a real-world thing. It can be a person, place, or even a


concept. Example: Teachers, Students, Course, Building, Department, etc are some of
the entities of a School Management System.
 Attributes: An entity contains a real-world property called attribute. This is the
characteristics of that attribute. Example: The entity teacher has the property like teacher
id, salary, age, etc.
 Relationship: Relationship tells how two attributes are related. Example: Teacher
works for a department.
Example:

In the above diagram, the entities are Teacher and Department. The attributes of Teacher entity
are Teacher_Name, Teacher_id, Age, Salary, Mobile_Number. The attributes of
entity Department entity are Dept_id, Dept_name. The two entities are connected using the
relationship. Here, each teacher works for a department.

Features of ER Model

 Graphical Representation for Better Understanding: It is very easy and simple to


understand so it can be used by the developers to communicate with the stakeholders.
 ER Diagram: ER diagram is used as a visual tool for representing the model.
 Database Design: This model helps the database designers to build the database and is
widely used in database design.
Advantages of ER Model

 Simple: Conceptually ER Model is very easy to build. If we know the relationship


between the attributes and the entities we can easily build the ER Diagram for the model.
 Effective Communication Tool: This model is used widely by the database designers
for communicating their ideas.
 Easy Conversion to any Model: This model maps well to the relational model and can
be easily converted relational model by converting the ER model to the table. This model
can also be converted to any other model like network model, hierarchical model etc.
Disadvantages of ER Model

 No industry standard for notation: There is no industry standard for developing an


ER model. So one developer might use notations which are not understood by other
developers.
 Hidden information: Some information might be lost or hidden in the ER model. As it
is a high-level view so there are chances that some details of information might be
hidden.

You might also like