Ahmad Farooqui Dbms Practical File
Ahmad Farooqui Dbms Practical File
Ahmad Farooqui Dbms Practical File
To Mr. Saif Farooqui , Sr. Instructor in the laboratory for helping me. My
presentation would not have been possible without their helps.
AHMAD FAROOQUI
1800103576
CONTENT
• Introduction to dbms
• History
• Definition of dbms
• Characteristics
• Types of dbms
• Advantages and disadvantages
• SQL
• Language
• Data Types Of Sql
• Sql Commands
INTRODUCTION TO DBMS
A database is an organized collection of data, generally stored and accessed electronically from a
computer system. Where databases are more complex they are often developed using
formal design and modeling techniques.
The database management system (DBMS) is the software that interacts with end users,
applications, and the database itself to capture and analyze the data. The DBMS software
additionally encompasses the core facilities provided to administer the database. The sum total of
the database, the DBMS and the associated applications can be referred to as a "database
system". Often the term "database" is also used to loosely refer to any of the DBMS, the database
system or an application associated with the database.
Computer scientists may classify database-management systems according to the database
models that they support. Relational databases became dominant in the 1980s. These model data
as rows and columns in a series of tables, and the vast majority use SQL for writing and querying
data. In the 2000s, non-relational databases became popular, referred to as NoSQL because they
use different query languages.
Formally, a "database" refers to a set of related data and the way it is organized. Access to this
data is usually provided by a "database management system" (DBMS) consisting of an integrated
set of computer software that allows users to interact with one or more databases and provides
access to all of the data contained in the database (although restrictions may exist that limit
access to particular data). The DBMS provides various functions that allow entry, storage and
retrieval of large quantities of information and provides ways to manage how that information is
organized.
Because of the close relationship between them, the term "database" is often used casually to
refer to both a database and the DBMS used to manipulate it.
Outside the world of professional information technology, the term database is often used to
refer to any collection of related data (such as a spreadsheet or a card index) as size and usage
requirements typically necessitate use of a database management system.
HISTORY
The sizes, capabilities, and performance of databases and their respective DBMSs have grown in
orders of magnitude. These performance increases were enabled by the technology progress in
the areas of processors, computer memory, computer storage, and computer networks. The
concept of a database was made possible by the emergence of direct access storage media such
as magnetic disks, which became widely available in the mid 1960s; earlier systems relied on
sequential storage of data on magnetic tape. The subsequent development of database technology
can be divided into three eras based on data model or structure: navigational, SQL/relational, and
post-relational.
The two main early navigational data models were the hierarchical model and
the CODASYL model (network model). These were characterized by the use of pointers (often
physical disk addresses) to follow relationships from one record to another.
The relational model, first proposed in 1970 by Edgar F. Codd, departed from this tradition by
insisting that applications should search for data by content, rather than by following links. The
relational model employs sets of ledger-style tables, each used for a different type of entity. Only
in the mid-1980s did computing hardware become powerful enough to allow the wide
deployment of relational systems (DBMSs plus applications). By the early 1990s, however,
relational systems dominated in all large-scale data processing applications, and as of 2018 they
remain dominant: IBM DB2, Oracle, MySQL, and Microsoft SQL Server are the most
searched DBMS.[9] The dominant database language, standardised SQL for the relational model,
has influenced database languages for other data models.
Object databases were developed in the 1980s to overcome the inconvenience of object-
relational impedance mismatch, which led to the coining of the term "post-relational" and also
the development of hybrid object-relational databases.
The next generation of post-relational databases in the late 2000s became known
as NoSQL databases, introducing fast key-value stores and document-oriented databases. A
competing "next generation" known as NewSQL databases attempted new implementations that
retained the relational/SQL model while aiming to match the high performance of NoSQL
compared to commercially available relational DBMSs.
• 1960 - Charles Bachman designed first DBMS system
• 1970 - Codd introduced IBM'S Information Management System (IMS)
• 1976- Peter Chen coined and defined the Entity-relationship model also know as the ER
model
• 1980 - Relational Model becomes a widely accepted database component
• 1985- Object-oriented DBMS develops.
• 1990s- Incorporation of object-orientation in relational DBMS.
• 1991- Microsoft ships MS access, a personal DBMS and that displaces all other personal
DBMS products.
• 1995: First Internet database applications
• 1997: XML applied to database processing. Many vendors begin to integrate XML into
DBMS products.
.
WHAT IS DBMS?
DBMS or Database Management System is a software application used to access,
create, and manage databases. With the help of DBMS, you can easily create, retrieve
and update data in databases. A DBMS consists of a group of commands to manipulate
the database and acts as an interface between the end-users and the database. Refer
below.
Database Management Systems also aims to facilitate an overview of the databases, by providing
a variety of administrative operations such as tuning, performance monitoring, and backup
recovery.
• Define Data – Allows the users to create, modify and delete the definitions which define
the organization of the database.
• Update Data – Provides access to the users to insert, modify and delete data from the
database.
• Retrieve Data – Allows the users to retrieve data from the database based on the
requirement.
• Administration of users – Registers the users and monitors their action, enforces data
security, maintains data integrity, monitors performance and deals with concurrency
control.
CHARACTERISTICS OF DBMS
• To limit the permissions of the users
• Provide multiple views of the single database schema
• Facilitates security and removes data redundancy
• Allows multi-user transaction processing and sharing of data
• Follows the ACID property
• Offers both physical and logical data independence
TYPES OF DBMS
Following are the different types of DBMS:
Advantages
• It offers a variety of methods to store and retrieve various formats of data using
the query language.
• It can be easily maintained because of its nature of a centralized database system.
• Facilitates multiple applications using the same data with less development and
maintenance time.
• Provides data security and integrity with minimal data duplicity and redundancy.
• It allows seamless integration into the application programming languages
like Java and Python to enable the users to connect a database with any application
or website.
• Has automatic backup and recovery systems to create an automatic backup of data.
• Authorizes users who can view, share and access data
Disadvantages
• Databases Management Systems are often complex systems.
• Few of the DBMS available in the market are licensed. So, you have to pay to us
that DBMS in your organization.
• Most leading companies store their data in a single database. Hence, if that
database is damaged due to any reason, the complete data would be lost.
• DBMS that you wish to use might not be compatible with an organization’s
operational requirements.
• DBMS are large in size and need time to setup.
SQL
Structured Query Language is a domain specific language used in programming and designed
for managing data held in a relational database management system (RDBMS), or for stream
processing in a relational data stream management system (RDSMS). It is particularly useful in
handling structured data, i.e. data incorporating relations among entities and variables.
SQL offers two main advantages over older read; firstly, it introduced the concept of accessing
many records with one single command. Secondly it eliminates the need to specify how to reach
a record, e.g. with or without an index.
RUNNING SQL*PLUS
In this section, we understand some general directions on how to get into the SQL*Plus program and
connect to an Oracle database. Specific instructions for the installation may vary depending on the version
of SQL*Plus being used, whether or not SQL*Net or Net8 is in use, etc.
Before using the SQL*Plus tool or any other development tool or utility, the user must obtain an Oracle
account for the DBMS. This account will include a username, a password and, optionally, a host string
indicating the database to connect to. This information can typically be obtained from the database
administrator.
The following directions apply to two commonly found installations: Windows XP or Windows 7 client
(from here on, referred to simply as a Windows client) with an Oracle server, and a UNIX/LINUX
installation.
RUNNING SQL*PLUS WINDOWS
To run the SQL*Plus command line program from Windows, click on the button, Programs,
Oracle – OraHomeXX, Application Development and then SQL*Plus. The SQL*Plus login screen will
appear after rough ly 15 seconds
In the User Name: field, type in your Oracle username. Press the TAB key to move to the next
field.
In the Password: field, type your Oracle password.
Press the TAB key to move to the next field.
In the Host String: field, type in the Service Name of the Oracle host to connect to.
(If the DBMS is Personal Oracle lite then this string might be ODBC: POLITE. If the DBMS is a local
Personal Oracle8, 8i or 9i database, then the host string might be either beq-local or in some cases, you
can leave this field blank to connect to your local database instance. Make certain your local instance is
started. For Client/Server installations with SQL*Net or Net8, this string will be the service name set up
by the SQL*Net or Net8 assistant software. Finally, click on the OK button to complete the Oracle log in
process. SQL*Plus will then establish a session with the Oracle DBMS and the SQL*Plus prompt (SQL>)
will appear. The following figure shows the results of logging into Oracle using SQL*Plus)
LANGUAGE
SQL COMMANDS:
CREATE TABLE:-
A table is basic unit of storage. It is composed of rows and columns. To create a table we will name the
table and the columns of the table. We follow the rules to name tables and columns:-
It must begin with a letter and can be up to 30 characters long.
It must not be duplicate and not any reserved word.
Syntax to create a table is
CREATE TABLE table name (column_name1 data type (size), column_name2 data type (size) …);
Example is
CREATE TABLE student (roll no number (4), name varchar2 (15));
SELECT:
The select command of SQL lets you make queries on the database. A query is a command that
is given certain specified information from the database tables. It can be used to retrieve a subset
of rows or columns from one or more tables.
Syntax to create a table is
SELECT <column_name1>,<column_name2> FROM <tablename>;
Example is
SELECT emp-no, e-name, sal from emp;
DESCRIBE:
To find information about columns like column name, their data types and other attributes of a
table we can use DESCRIBE command. Syntax to describe table is DESCRIBE tablename
ALTER TABLE:-
After creating table one may need to change the table either by add new columns or by modify
existing columns. One can do so by using alter table command.
Syntax to add a column is ALTER TABLE tablename ADD (col1 datatype,col2 datatype);
Syntax to modify a column is ALTER TABLE tablename MODIFY (col1 datatype,col2
datatype);
DELETE: One can delete data from table by using delete from statement. The delete
statement removes rows from table but it doesn’t release storage space. Syntax of delete rows
from table is
DELETE FROM tablename WHERE <condition>;
INSERT:
To add new rows in an existing oracle table the insert command is used. Syntax to add new
fields is
INSERT INTO tablename(col1,col2,col3,..) VALUES (value1,value2,value3);
Example is
INSERT INTO employee (emp_id,ename,desg,basic_pay) VALUES
(100001,’MOHIT’,’MANAGER’,55000);
UPDATE:
The update command enables user to change the values of existing rows. Syntax to update value
of table is UPDATE table name SET col1=value1,col2=value2;
Example is UPDATE emp_info SET salary =salary +100;
DROP TABLE:
To remove the definition of oracle table, the drop table statement is used. Syntax to drop table is
DROP TABLE tablename.
RENAME:
One can change the name of a table by rename command Syntax to rename table is RENAME
old name TO new name.