Selfstudys Com File
Selfstudys Com File
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)
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
Summary
Basic concepts of database.
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.
29