0% found this document useful (0 votes)
7 views10 pages

Selfstudys Com File

The document provides an introduction to Database Management Systems (DBMS) and their applications, highlighting the importance of organized data and the distinction between data and information. It covers various types of databases, advantages of using DBMS, data types, and the structure of relational databases, including keys and relationships. Additionally, it explains SQL (Structured Query Language) and its categories, including Data Definition Language (DDL), Data Manipulation Language (DML), and Data Control Language (DCL).

Uploaded by

simrashaikh008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views10 pages

Selfstudys Com File

The document provides an introduction to Database Management Systems (DBMS) and their applications, highlighting the importance of organized data and the distinction between data and information. It covers various types of databases, advantages of using DBMS, data types, and the structure of relational databases, including keys and relationships. Additionally, it explains SQL (Structured Query Language) and its categories, including Data Definition Language (DDL), Data Manipulation Language (DML), and Data Control Language (DCL).

Uploaded by

simrashaikh008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

2 Introduction to DBMS

Let us Learn card. In a report card, the combined


(marks) data of all subjects speaks about
 Concept of Database.
students performance. Thus when data
 Introduction to DBMS and RDBMS is maintained in an organized manner
 Advantages of using database it becomes meaningful or organized
management system. information.
 Type for storage of data in a database. Data vs Information
 To understand Structured Query Data Information
Language. Data is raw facts Information is
processed data

2.1 Introduction Data does not help Information


in decision making helps in decision
In our day to day life every person making
uses database in various ways. Like
people use phone diary or phone book Data could Without data
which contains name, address email id, be relevant or information
phone number etc. irrelevant cannot be
Doctor maintains medical history of processed
patients. Librarian maintains records of
Each student's The average
their book details, issue date, return date.
exam score is one score of a
etc. Teacher keeps records of students like
piece of data. class or of the
name, roll number, Marks etc. In these
entire school is
examples every one maintains records in information that
a systematic manner. can be derived
In a computer system, we always from the given
maintain our records. At this point a data.
database is very useful.
2.2 Definition of a Database
Table: 1 Data vs Information
Database is collection of interrelated
data which helps in efficient retrieval,
inserting and deleting of data. In exams,
 Do it yourself
 Collect five examples of data and
marks obtained by the student in subjects
information
is data before it is entered in the report

20
2.3 Introduction to Database customers can send or get money
Management System (DBMS) through banks. All this is possible just
because of DBMS that manages all
A database, often abbreviated as DB,
the bank transactions.
is a collection of information organized
in such a way that a computer program  Universities and Colleges :
can quickly select desired pieces of data. Examinations are done online today
A Database Management System and universities and colleges maintain
(DBMS) is a software for creating all these records through DBMS.
and managing databases. The DBMS Student’s registration details, results,
provides users and programmers with a courses and grades all the information
systematic way to create, retrieve, update is stored in a database.
and manage data. It stores data in such  Credit Card Transactions :
a way that it becomes easier to retrieve, For purchase of credit cards and
manipulate, and update information. all the other transactions are made
Examples of popular DBMS are : possible only by DBMS. A credit
card holder knows the importance of
MySQL, PostgreSQL, Access, Oracle,
his information that all are secured
SQL Server, IBM, DB2 and Sybase.
through DBMS.
2.4 Some Applications of DBMS  Social Media Sites :
 Railway Reservation System : We all are on social media websites to
Database is required to keep record of share our views and connect with our
ticket booking, train’s departure and friends. Daily, millions of users sign
arrival status, status of seats available up for these social media accounts
etc. like Facebook, Twitter, Pinterest
and Google plus. But how is all the
 Library Management System :
information of users stored and how
There are thousands of books in the
are we able to connect to other people?
library so it is very difficult to keep
Yes, this is all because of DBMS.
a record of all the books in a copy or
register. So DBMS is used to maintain 2.5 Advantages of DBMS
all the information related to book
 Reducing Data Redundancy :
issue dates, name of the book, author
The file based data management
and availability of the book.
systems contained multiple files
 Banking : that were stored in many different
People make thousands of locations in a system or even across
transactions through banks daily and multiple systems. Because of this,
they can do this without going to the there were sometimes multiple copies
bank. So now banking has become of the same file which lead to data
so easy that by sitting at home bank redundancy.
21
This is prevented in a database  Privacy :
as there is a single database and any The privacy rule in a database means
change in it is reflected immediately. only the authorized users can access
Because of this, there is no chance of a database according to its privacy
encountering duplicate data. constraints. There are levels of
 Sharing of Data : database access and a user can only
In a database, the users of the view the data. For example - In social
database can share the data among networking sites, access constraints
themselves. There are various are different for different accounts a
levels of authorisation to access user may want to access.
the data, and consequently the data  Backup and Recovery :
can only be shared based on the
Database Management System
correct authorisation protocols being
automatically takes care of backup
followed.
and recovery. The users don't need
Many remote users can also access
to backup data periodically because
the database simultaneously and
share the data between themselves. this is taken care of by the DBMS.
Moreover, it also restores the database
 Data Integrity : after a crash or system failure to its
Data integrity means that the data previous condition.
is accurate and consistent in the
database. Data Integrity is very  Development and Maintenance Time :
important as there are multiple DBMS reduces application
databases in a DBMS. All of these development and maintenance
databases contain data that is visible time. It supports many important
to multiple users. So it is necessary functions that are common to many
to ensure that the data is correct and applications, accessing data stored
consistent in all the databases and for in the DBMS, which facilitates the
all the users. quick development of application.
 Data Security :
2.6 Data types in the DBMS
Data Security is vital concept in
a database. Only authorised users When you create a table or add a
should be allowed to access the field to a table in the database, fields
database and their identity should be are created with specific data type. Data
authenticated using a username and types are classifications that identify
password. Unauthorised users should possible values for and operations that
not be allowed to access the database can be done on the data, as well as the
under any circumstances as it violates way the data in that field is stored in the
the integrity constraints. database.

22
2.7 Data model
Class Data Type Description
Database is designed according to
Holds a certain rules. This logical structure of
fixed length
string (can database is known as a model. Data
contain letters, models define how the data is connected
CHAR
numbers, to each other and how they are processed
and special and stored inside the system.
characters).
The fixed size It describes the method of storing and
is specified in retrieving the data. There are different
parenthesis. models like network model, hierarchical
Text
Holds a model and relational model. Let us see
variable length relational model.
string (can Relational Model :
contain letters,
VARCHAR numbers, The most popular data model in DBMS
and special is the Relational Model. Relational data
characters). model is the primary data model, which
The maximum
is used widely around the world for data
size is specified
in parenthesis. storage and processing. This model is
simple and has all the properties and
It can represent
capabilities required to process data with
numbers with
DECIMAL or storage efficiency.
without the  A transaction is a unit of work that
Numeric fractional part
is performed against a database.
It is used for For example, if you are creating
INT storing integer a record or updating a record or
values. deleting a record from the table, then
It holds the date you are performing a transaction on
Date DATE including day, that table. It is important to control
month and year these transactions to ensure the data
It holds time. integrity and to handle database
Time TIME() Format: errors.
HH:MM:SS Properties of Transactions :
Table: 2 Data types in DBMS Transactions have the following four
standard properties, usually referred to
 Do it yourself by the acronym ACID.
 You have scored 75.56% in the
recent examination. Which data  Atomicity : It ensures that all
operations within the work unit are
type would you prefer to use for
completed successfully. Otherwise,
storing this data ?
the transaction is aborted at the
23
point of failure and all the previous stored in a table. Database designer
operations are rolled back to their decides the name of the table and
former state. titles of columns.
 Consistency : It ensures that the da-  Field : A table consists of information
tabase properly changes states upon a which is stored under different
successfully committed transaction. headings, called as fields or columns.
 Isolation : It enables transactions to Columns are shown vertically in a
operate independently of and table. Each field or column has an
transparent to each other. individual name. Two columns cannot
have the same name. In Fig. no. 1, the
 Durability : It ensures that the result
first row represents the different field
or effect of a committed transaction
names or titles of columns.
persists in case of a system failure.
 Record : All the columns in a table
2.8 Introduction of RDBMS make a row. Each row contains
RDBMS stands for Relational information on individual topics.
Database Management System. In A record is composed of fields and
RDBMS a database is considered as a contains all the data about one
collection of interrelated data. particular person, company, or item
in a database. Record is also called
Basic Database Concept as a Tuple.
 Table : The table is the basic data  Key : A column or a combination of
storage unit in a Relational database. columns which can be used to identify
Table consists of columns and rows. one or more rows (tuples) in a table is
A database consists of one or more called a key of the table.
tables according to which data is

Column (field)

Position Title Education Requirements Functional Area Max Pay Min Pay
Executive Assitant Associate degree Human Resource 60,000 40,000
Row (record)
Recruiter Bachelor's degree Human Resource 110,000 85,000
SW Engineer Bachelor's degree Engineering 140,000 110,000
SQA Engineer Bachelor's degree Engineering 140,000 110,000

Data Value

Table (object)

Fig. 1 : Table in Database


24
 Primary Key : The group of one each Passport_ ID is assigned to only one
or more columns used to uniquely person.
identify each row of a relation is A one-to-one relationship looks like
called its Primary Key. below in the relationships graph :
 Foreign Key : It is a field (or collection
of fields) in one table that refers to the
Primary Key in another table.
Relationships in database :
Relationships link data from
individual tables to increase the usefulness
of the database.
A relationship in the context of Fig. 2
databases, is a situation that exists
between two relational database tables
One-to-Many (or Many-to-One)
when one table has a foreign key that is
used as a reference to the primary key of This is the most common relationship
the other table. type. In this type of relationship, a row
in table City can have many matching
For example, a table called Employees
rows in table Customer, but a row in table
has a primary key called employee_id.
Customer can have only one matching
Another table called Employee Details
row in table City
has a foreign key which references
employee_id in order to uniquely identify
the relationship between the two tables.
There are 3 types of relationships in
relational database design. They are :
 One-to-One
Fig. 3
 One-to-Many (or Many-to-One)
Example of one-to-many relationship
 Many-to-Many
One-to-Many relationships can also
These are explained below.
be viewed as Many-to-One relationships,
One-to-One : depending on which way you look at it.
In a one-to-one relationship, one In the above example, the Customer
record in a table is associated with one table is the “many” and the City table
and only one record in another table. For is the “one”. Each customer can only
example, in a company database, each be assigned one city,. One city can be
employee has only one Person_ ID, and assigned to many customers.

25
Many-to-Many  Delete records from a database
A many-to-many relationship occurs  Execute queries against a database
when multiple records in a table are  Create stored procedures in a
associated with multiple records in database
another table.  Create views in a database.
Multiple records in Table Product
are linked to multiple records in Table  Do it yourself
Suppliers.
 Explain the purpose of SQL

Product Supplier
2.10 Categories of SQL Commands
Prod ID Supplier ID
Description Description
Price Address Data Definition Language (DDL)
Supplier Telephone
Commands
Fig. 4
DDL statements or commands are
used to define and modify the database
2.9 Introduction to SQL
structure of your tables or schema. When
SQL is Structured Query Language, you execute a DDL statement, it takes
which is a computer language for effect immediately.
storing, manipulating and retrieving data
stored in a relational database. SQL is Data Definition Language
the standard language for Relational (DDL) commands
Database Management System. All COMMAND USED FOR
relational database management systems
like MySQL, Base, Oracle, Sybase, CREATE DATABASE Creates database
Informix, Postgres and SQL Server use CREATE TABLE Creates a new table
SQL as standard database language.
ALTER TABLE Modifies a table
SQL became a standard of the American
DROP TABLE Deletes a table or
National Standards Institute (ANSI)
in 1986, and of the International DROP DATABASE Database
Organization for Standardization (ISO)
in 1987. Table: 3 DDL Commands

Using SQL You Can : Data Manipulation Language (DML)


Commands
 Create new databases.
 Create new tables in a database Data Manipulation Language (DML)
 Insert records in a database statements or commands are used for
managing data within tables.
 Retrieve data from a database
 Update records in a database
26
DCL is used to control user access
Data Manipulation Language
(DML) Commands in a database. it is related to security
issue. it is also deals with the rights and
COMMAND USED FOR permissions of the databse access.
SELECT Extracts data from a table
Data Control Language
UPDATE Updates data in a table (DCL) commands

DELETE Deletes data from a table COMMAND USED FOR

INSERT Insert data into a table GRANT To provide access or


INTO privileges on the database
objects.
Table: 4 DML Commands
REVOKE To remove access rights or
Data Control Language (DCL) privileges on the database
Commands object.

Table: 5 DCL Commands

Summary
 Basic concepts of database.

 We get to know difference between Data and Information.

 Database management system(DBMS) is used to create,


manipulate and retrieve database.

 DBMS is used in various fields like railway, library, schools,


colleges, credit transactions, banking.

 Benefits of DBMS are data sharing, data integrity, security, consistency,


recovery.

 RDBMS means relational database management system.

 Relations in database are one to one, one to many or (many to one)


and many to many.

 Categories of SQL Commands : DDL, DML and DCL

27
Exercise
Q. 1 Complete the following activity. Q. 2 Observe the field names of a
1. Tick whichever box is not valid. database given below in ‘Column
A’ related to Bus reservation.
Write suitable data types for each
Graphic field in front of the respective field
in ‘Column B’
Date Column A Column B
Data type
(Field Name) (Data Type)
Number Passenger Name
Age
Text Gender
Mobile Number
Q. 3 Write the use of following SQL
2. Student wants to create a field command.
pincode in a table, which data
type he will choose ? Command Use

INSERT ________________
3. Tick the appropriate box.

is also called UPDATE ________________


Primary key foreign key

Uniquely identifies Q.4 Create a table for the information


a record given below by choosing
appropriate data types. Specify
4. Tick the appropriate circle.
proper primary key for the table
Only one 1) Movie 2) Actor
record 1. Movie ( Registeration_no,
Database has
movie_name, Realease_Date)
Only single
table 2. Actor ( actor_id, Actor_name,
birth_date )
None of these One or many
tables
28
Q. 5 Consider the following table Q.7 In a company the data is stored in
Stationary. Write SQL commands a table under the following fields
for following statements. Employee number, Last name,
Table : Stationary Date of birth, Address. Which
S_ID S_Name C_ Name Price Quantity data type will you use for the
above field.
001 NoteBook ABC 20 50
002 Pencil box XYZ 10 80 Datatype??? ???
003 A4Pages PQR 600 2
Employee Name last name
rim

1) Write SQL command to create


above Table
company table

2) Write SQL command to insert


??? ???
above mentioned record in table
Address Date of birth

3) To delete above table. Q.8 Multiple choice select three correct


answers.
1) Valid relationships in RDBMS are
a) one to one b) one to two
Q.6 Answer the following questions. c) one to many d) many to two
1) What is a database ? e) many to many f) one to three

2) What are the advantages of a Q.9 Complete the following.


DBMS ?
Use Command
3) What do you understand by Data
Model ?
To remove access rights or
4) What is a primary key ? previleges from the database

5) What is DDL(Data Definition


language) Extracts data from
a table


29

You might also like