Vasu Dbms Practical File
Vasu Dbms Practical File
RDBMS Database
A relational database management system (RDBMS) stores data in a tabular form where
a column represents a property and each row in a table represents a record. RDBMS
allows Create, Read, Update, and Delete (CRUD) operations. Structured Query
Language (SQL) is the language that is used to query, update, and delete data in
SQL language queries are also known as SQL commands or SQL statements.
1. Oracle
2. MySQL
3. SQL Server
4. PostgreSQL
5. IBM DB2
6. Microsoft Access
7. SQLite
8. MariaDB
9. Informix
10. Azure SQL
Oracle
Oracle Database is a relational database management system (RDBMS) developed by
Oracle Corporation. It is a software system that allows users to store, organize, and retrieve
The Oracle Database is designed to run on various operating systems, including Windows,
Unix, and Linux. Businesses and organizations of all sizes use it for various applications,
data warehousing.
The Oracle Database offers advanced features such as high availability, scalability,
security, and performance tuning, making it a popular choice for large-scale and mission-
allowing developers to build custom applications that can access and manipulate the
database.
Oracle Live SQL is a web-based SQL editor with an Oracle database built-in. It’s
maintained by Oracle and allows you to write and run SQL statements easily without
As of October 2022, Oracle Live SQL runs Oracle database version 19c Enterprise Edition
–
19.14.0.0.0.
How to Access?
You can access Oracle Live SQL by going to livesql.oracle.com.
The main feature of this page is to allow you to search or browse for tutorials. We’ll cover
this later in the guide, but Oracle Live SQL includes a range of tutorials to help you learn
specific features of Oracle, where you can read instructions and run the SQL right in the
browser.
You can also just access an SQL editor by clicking Start Coding Now.
Once you’ve signed in, this is the main Oracle Live SQL screen you’ll see.
There is a range of things on the screen:
Sidebar: On the left, you’ll see a sidebar that includes a few menu items such as Home,
My
Session, and Schema. We’ll cover these options later in this guide. If you don’t see this
sidebar, you can click on the hamburger menu to show and hide it.
SQL Worksheet: the top part of the main area of the screen is the SQL Worksheet. You
Output: the output of your SQL statements is shown at the bottom of the screen. This can
be resized up and down to make more room for the SQL or more room for the output.
Buttons: on the top right of the screen you can see a few buttons:
preference.
• Save: save your SQL worksheet
Footer: on the bottom of the screen, you can see some information about the tool: what
version of Oracle Live SQL is published, what Oracle database version it uses, and some
• High availability: The database has built-in mechanisms for data protection and
such as encryption, access controls, and auditing, ensuring that data is kept safe
caching, indexing, and query optimization technologies, as well as support for in-
• Manageability: Oracle Database includes a range of tools and features for managing
the database, such as graphical user interfaces, command-line interfaces, and APIs,
which simplify tasks such as database monitoring, backup and recovery, and
performance tuning.
• Compatibility: The database supports a wide range of programming languages and
interfaces, including SQL, PL/SQL, Java, and .NET, allowing developers to build
custom applications that can access and manipulate the data in the database.
History of Oracle
Oracle Corporation was founded by Lawrence Ellison (Larry Ellison), Bob Miner, Ed
Oates, and Bruce Scott in August 1977. They have a lot of experience in building database
programs for several companies and builds their first project (a special database program)
for the CIA (Central Intelligence Agency). Oracle was named after "Project Oracle," a
project for one of their clients named Central Intelligence Agency, and the company that
created Oracle was called Systems Development Labs (SDL). Systems Development Labs
was renamed Relational Software Inc. (RSI) in 1978 to expand their market for the new
database. They had again changed the name of the company from RSI to Oracle Systems
Corporation in 1982.
The first commercially available RDBMS named Oracle V2 (Version 2) was built using
PDP-
commercial RDBMS in 1977, it wasn't available for purchase until 1979, when Oracle
In 1983, Oracle database portable version named "Oracle version 3" was released. This
version was written in the C programming language. It was the first relational database that
can run in mainframes, minicomputers, PCs, or any hardware with a C compiler. It also
This new feature has the capability to connect the client's software to a database
o In 1989, Oracle 6 added support for PL/SQL language. It also comes with new
features such as OLTP high-speed systems, hot backup capability, and row-level
locking.
o In 1992, Oracle 7 was released. This version comes in the market as a result of four
years of hard work and two years of customer testing. It added some exciting
performance. o In 1997, Oracle 8 was released. This version comes with the support
of ORDBMS that was designed to work with Oracle's network computer (NC). It
o In 1998, Oracle 8i was released. Here 'I' stands for Internet. It was the first database
version that added support for Web technologies such as Java and HTTP.
o In 2001, Oracle 9i was released with 400 new features such as XML, RAC (Real
Application Clusters), etc. These features reduce database size and provide high
o In 2003, Oracle 10g was released with grid computing technology means grid. It
o In 2006, Oracle 11g was released. This version comes with new features such as
o In Feb 2018, Oracle 18 C was released. This version was the world's first
autonomous database.
Introduction to SQL
Structure Query Language(SQL) is a database query language used for storing and
managing data in Relational DBMS. SQL was the first commercial language introduced for
E.F Codd's Relational model of database. Today almost all RDBMS(MySql, Oracle,
Infomix, Sybase, MS Access) use SQL as the standard database query language. SQL is
SQL Command
This includes changes to the structure of the table like creation of table, altering table,
All DDL commands are auto-committed. That means it saves all the changes permanently
in the database.
Command Description
DML commands are used for manipulating the data stored in the table and not the table
itself.
DML commands are not auto-committed. It means changes are not permanent to database,
Command Description
These commands are to keep a check on other commands and their affect on the database.
These commands can annul changes made by other commands by rolling the data back to
its original state. It can also make any temporary change permanent.
Command Description
Data control language are the commands to grant and take back authority from any
database user.
Command Description
In Oracle, every value has a data type that defines a set of characteristics for the value.
These characteristics cause Oracle to treat the values of one data type differently from the
values of another. For example, you can add values of the NUMBER data type, but not
When creating a new table, you specify a data type for each of its columns. Similarly, when
you create a new procedure, you specify a data type for each of its arguments.
The data type defines the allowed values that each column or argument can store. For
example, a DATE column cannot store a value of February 30, because this is not a valid
date.
Oracle has a number of built-in data types illustrated in the following table:
1 NVARCHAR2(size)
2 NUMBER[(precision [, scale]])
8 LONG
12 DATE
21 BINARY_FLOAT
22 BINARY_DOUBLE
23 RAW(size)
24 LONG RAW
69 ROWID
96 NCHAR[(size)]
112 CLOB
112 NCLOB
113 BLOB
114 BFILE
Each data type has a code managed internally by Oracle. To find the data type code of a
VARCHAR.
The NCHAR and NVARCHAR2 data types are for storing Unicode character strings.
The fixed-length character data types are CHAR, NCHAR and the variable-length character
VARCHAR is the synonym of VARCHAR2. However, you should not use VARCHAR
because Oracle may change its semantics in the future. For character data
The NUMBER data type has precision p and scale s. The precision ranges from 1 to 38
If you don’t specify the precision, the column can store values including fixed-point and
Datetime data types are DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, and
TIMESTAMP WITH LOCAL TIME ZONE. The values of a datetime data type are
datetimes.
The interval data types are INTERVAL YEAR TO MONTH and INTERVAL DAY TO
SECOND. The values of the interval data type are intervals.
The RAW and LONG RAW data types are for storing binary data or byte strings e.g., the
The RAW data type can store up to 2000 bytes while the LONG RAW data type can store
up to 2GB.
Exercise on Creation of Table
Relation Name: P
Column Data Width Constraints
Name Type
Pno Varchar2 5 Primary Key
Pname Varchar2 20 Unique
Color Varchar2 20 Not Null
City Varchar2 20 City must be Jalandhar, Patiala,
Amritsar and Qadian
Relation Name: SP
Column Data Widt Constrains
Name Type h
Sno Varchar 5 Refers Sno of Supplier table
2
Pno Varchar 5 Refers Pno of Part table
2
Qty Numbe 4 Must be greater than 100
r
create table S(
Sname varchar2(20),
chkstatus_S CHECK(Status>10)
);
create table P(
Pname varchar2(20),
UNIQUE(Pname),
);
Qty number(4),
constraint fk1_SP FOREIGN KEY(Pno) REFERENCES P(Pno),
);
desc S;
desc P;
desc SP;
-- b) The primary key of SP table is a composite primary key combining Pno and Sno.
Alter Table SP
Relation Name: P
PNO NAME COLOR CITY
P1 NUT RED QADIAN
P2 BOLT GREEN AMRITSAR
P3 SCREW BLUE JALANDHAR
P4 SCREW RED QADIAN
Relation Name: SP
SNO PNO QTY SNO
S1 P1 250 S1
S1 P2 300 S1
S1 P3 500 S1
S2 P1 250 S2
--a)
INSERT ALL
INTO S VALUES('S1','SUNEET','Qadian',20)
INTO S VALUES('S2','ANKIT','Amritsar',11)
INTO S VALUES('S3','AMIT','Patiala',30)
SELECT * FROM dual;
SELECT * from S;
INSERT ALL
INTO P VALUES('P1','NUT','Qadian','RED')
INTO P VALUES('P2','BOLT','Amritsar','GREEN')
INTO P VALUES('P3','SCREW','Jalandhar','BLUE')
INTO P VALUES('P4','SCREW1','Qadian','RED')
SELECT * from P;
INSERT ALL
Values('S4','Vasu','Chandigarh',30);
Values('S1','Vasu','Qadian',30);