100% found this document useful (1 vote)
191 views30 pages

Dbms Lab File

Uploaded by

Vipul kumar Jha
This document provides an introduction to Oracle databases, SQL, and ISQL Plus. It defines Oracle as a relational database management system from Oracle Corporation. It discusses the different editions of Oracle including Enterprise Edition, Standard Edition, and Express Edition. It also provides a history of Oracle, describing the different versions released from 1977 to present. It then defines SQL and its uses, characteristics, and advantages. Finally, it introduces ISQL Plus as a browser-based interface that allows users to connect to Oracle databases and perform SQL and PL/SQL commands through a web browser.

Copyright:

© All Rights Reserved

Available Formats

Download as PDF, TXT or read online on Scribd
Download as pdf or txt
100% found this document useful (1 vote)
191 views30 pages

Dbms Lab File

Uploaded by

Vipul kumar Jha
This document provides an introduction to Oracle databases, SQL, and ISQL Plus. It defines Oracle as a relational database management system from Oracle Corporation. It discusses the different editions of Oracle including Enterprise Edition, Standard Edition, and Express Edition. It also provides a history of Oracle, describing the different versions released from 1977 to present. It then defines SQL and its uses, characteristics, and advantages. Finally, it introduces ISQL Plus as a browser-based interface that allows users to connect to Oracle databases and perform SQL and PL/SQL commands through a web browser.

Copyright:

© All Rights Reserved

Available Formats

Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 30

Department of CSE

Subject: DBMS Lab


Subject Code: PCC-CS-501

Faculty Name: Student Name & Roll no:


Ms. Sakshi Kumar Vipul Jha
20011018030
INDEX

S.No Name of the Exercise Date Signature


1.

Introduction to Oracle,SQL, ISQL+

2.

DDL AND DML Commands

3. .
Operators in SQL

4.
Functions in SQL

5.
Joins in SQL

6.
Subqueries in SQL
Program 1

Aim : INTODUCTION TO ORACLE , SQL, ISQL PLUS.

Theory :
A) Introduction to Oracle : Oracle is a product from Oracle corporation that provides a relational
database management system. RDBMS supports any kind of data model. It has different product
editions, including Standard Edition, Enterprise Edition, Express Edition, and Personal Edition.
Oracle products are scalable and secure, with high-performance ability.

Oracle database is a relational database management system (RDBMS) from Oracle Corporation.
This article will explain a complete overview of the Oracle database, features, history, and editions.
Before discussing the oracle, we will first need to know about the database.
Oracle database is a relational database management system. It is also called OracleDB, or
simply Oracle. It is produced and marketed by Oracle Corporation. It was created
in 1977 by Lawrence Ellison and other engineers. It is one of the most popular relational database
engines in the IT market for storing, organizing, and retrieving data.
Oracle database was the first DB that designed for enterprise grid computing and data
warehousing. Enterprise grid computing provides the most flexible and cost-effective way to
manage information and applications. It uses SQL queries as a language for interacting with the
database.

EDITIONS OF ORACLE :

Oracle database is compatible with a wide range of platforms such as Windows, UNIX, Linux, and
macOS. It supports several operating systems like IBM AIX, HP-UX, Linux, Microsoft Windows
Server, Solaris, SunOS, macOS, etc. In the late 1990s, Oracle began supporting open platforms like
GNU/Linux.
The following is a list of Oracle database editions :
 Enterprise Edition: It is the most robust and secure edition. It offers all features, including
superior performance and security.
 Standard Edition:It provides the base functionality for users that do not require Enterprise
Edition's robust package.
 Express Edition: It is the lightweight, free and limited Windows, and Linux edition.
 Oracle lite:It is designed for mobile devices.
 Personal Edition:It's comparable to the Enterprise Edition but without the Oracle Real
Application Clusters feature.
HISTORY OF ORACLE
Oracle Corporation is the largest software company to develop and markets computer software
applications for business. The company is best known for its Oracle database products and, more
recently, cloud products and services. Its relational database was the first to support SQL, which has
since become the industry standard.Oracle database is one of the most trusted and widely used
relational database engines. The biggest rival of Oracle database is Microsoft's SQL Server.

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-11
assembler language (SQL-based RDBMS). Although they already developed a commercial
RDBMS in 1977, it wasn't available for purchase until 1979, when Oracle version 2 was released.
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 supports SQL queries
and transactions execution.
The other versions of Oracle are :
 In 1984, Oracle 4 was released that supports Transactions [Commit/Rollback],
export/import utilities, and the report writer.
 In 1985, Oracle 5 was released, which provides support for Client-Server Architecture. This
new feature has the capability to connect the client's software to a database server through a
network.
 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.
 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 features and
capabilities in the area of security, administration, development, and performance.
 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 also added support for Java,
HTML, and OLTP.
 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.
 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 availability
& enhanced performance.
 In 2003, Oracle 10g was released with grid computing technology means grid. It was the
first version that supports 64-bit LINUX OS.
 In 2006, Oracle 11g was released. This version comes with new features such as Oracle
Database Replay, Transaction Management using Log Miner, Virtual Column Partitioning,
Case sensitive passwords, Online Patching, Parallel Backups on the same file using RMAN,
and many others.
 In July 2014, Oracle 12C was released with Cloud support.
 In Feb 2018, Oracle 18 C was released. This version was the world's first autonomous
database.

B) Introduction to SQL:
SQL is a standard language for accessing and manipulating databases.SQL stands for Structured
Query Language. SQL became a standard of the American National Standards Institute (ANSI) in
1986, and of the International Organization for Standardization (ISO) in 1987.
CHARACTERSTICS OF SQL:
 SQL can execute queries against a database
 SQL can retrieve data from a database
 SQL can insert records in a database
 SQL can update records in a database
 SQL can delete records from a database
 SQL can create new tables in a database
 SQL can create stored procedures in a database
 SQL can set permissions on tables, procedures, and views
All the RDBMS like MySQL, Informix, Oracle, MS Access and SQL Server use SQL as their
standard database language.SQL allows users to query the database in a number of ways, using
English-like statements.
RULES For writing SQL commands:
 Structure query language is not case sensitive. Generally, keywords of SQL are written in
uppercase.
 Statements of SQL are dependent on text lines. We can use a single SQL statement on one
or multiple text line.
 Using the SQL statements, you can perform most of the actions in a database.
 SQL depends on tuple relational calculus and relational algebra.

When an SQL command is executing for any RDBMS, then the system figure out the best way to
carry out the request and the SQL engine determines that how to interpret the task.In the process,
various components are included. These components can be optimization Engine, Query engine,
Query dispatcher, classic, etc. All the non-SQL queries are handled by the classic query engine, but
SQL query engine won't handle logical files.
ADVANTAGES OF SQL:
 High Speed: Using the SQL queries, the user can quickly and efficiently retrieve a large
amount of records from a database.
 No Coding Needed: In the standard SQL, it is very easy to manage the database system. It
doesn't require a substantial amount of code to manage the database system.
 Portability: SQL can be used in laptop, PCs, server and even some mobile phones.
 Interactive Language: SQL is a domain language used to communicate with the database.
It is also used to receive answers to the complex questions in seconds.

C) INTRODUCTION TO ISQL PLUS :

iSQL*Plus is a browser-based interface to SQL*Plus. iSQL*Plus is a component of the SQL*Plus


product.iSQL*Plus enables you to use a web browser to connect to Oracle9i and perform the same
actions as you would through the command line version of SQL*Plus (known as SQL*Plus in this
guide). You can use iSQL*Plus to write SQL*Plus, SQL and PL/SQL commands to:
 Enter, edit, run and save SQL commands and PL/SQL blocks.
 Calculate, and print query results.
 List column definitions for any table.
 Access and copy data between databases.
 Perform database administration.
TheiSQL*Plus Server is a new feature available in Oracle9ithat provides browser-based access
toSQL*Plus capabilities. SQL*Plus is a basic software tool that allows Oracle users to enter and
execute SQL and PL/SQL commands. Course Technology authors present usage of the SQL*Plus
client tool within a number of the Oracle series texts. However, theiSQL*Plus interface has several
differences from the client SQL*Plus tool. Therefore, this introduction serves to introduce the
browser-based interface and identify some of the execution differences that you may encounter
when using iSQL*Plus versus client SQL*Plus.iSQL*Plus is advantageous in academic settings
because no client machine setup or installation is required. Users simply need Web browser
software and an Internet connection to access the Oracle9idatabase server. In addition, iSQL*Plus
provides a more user-friendly interface.
The advantages of iSQL*Plus are:
 Access to the Oracle 9idatabase from any computer connected to the Internet or internet.
 Command-line editing capabilities
 User -Friendly interface
 Acess to help files
 Ability to save the history of a session
 Unique identification of each iSQL*Plus session so that multiple connections are allowed
The architecture is three tier combined are:
 Client tier: The iSQL*Plus interface is usually a Web browser; only the URL of the
OracleHTTP server is required to connect to Oracle 9i.
 Middle Tier: It uses the iSQL*Plus Server, Oracle Net , Oracle HTTP Server.
 Database Tier: It uses Oracle9i.

STATEMENTS IN ISQL*PLUS:
 Typethe statements directly into the Enter statements text area or work area.
 Copytext from a text editor and paste it into the Enter statements area.
 Use the Browse and LoadScriptbuttons to load statements from a file.
PROGRAM 2

Aim: DDL and DML commands.

Q.1) Create a table named yourname_emp having the following attributes.

emp_id Number

emp_name varchar(40)

department varchar(20)

designation varchar2(40)

date_of_birth date

date_of_joining date

salary number

contact_no number

address varchar2(100)
Describe the structure of the table.
Answer:
Q.2) Insert the valid data of 10 employees to the table yourname_emp. Make sure at least 2
employees should have salary < 8000.
Answer:
Q.3) Update the designation of employees who are having salary < 8000.
Answer:
Q.4) Delete all the employees who belong to a particular department.
Answer:
Q.5) Alter the structure of table yourname_emp.
Add a new column manager_name of varchar2(40) type. Update the values in the manager_name
column.
Modify the column emp_name by changing its size to 60.
Drop any two columns from the table yourname_emp.
Answer:
Q.6) Rename table yourname_emp to yourname_empcserollno.
Answer:
PROGRAM 3

AIM: Operators in SQL.


Q1) Display the Name, Salary and EID of all the employees whose salary greater than 50000 and name
starts with S.
Answer:

Q2) Display the name and salary of all employees whose salary is between 2500 to 5000.

Answer :
Q3) Display Annual salary of all the employee and name the column as “Annual Salary”.

Answer:
Q4) Display the name and Id of all employees whose Id is not 20, 10 or 40.
PROGRAM 4

Aim: Functions in SQL.


Q1) Create a table named Employees_yourname having the following column names. The datatype
you can mention accordingly:
Employee_ID
First_Name
Last_Name
Salary
Department_ID
Date_of_Joining
Insert around 15 rows in the table. For each employee, display the Employee_ID, Last_Name, Salary
and Salary increased by 15% and expressed as a whole number. Label the colum New Salary. Save
your SQL Statement in a text file as Prog 3_2.sql

Answer:
Q3) Modify your query Prog 3_2.sql to add a column that subtracts the old salary from the new salary.
Label the column Increase.
Answer :
Q4)Write a query that displays the employee’s last name combined with first name. Label the column
Employee_Name with the first letter capitalized and all other letters lowercase.
A) Find the length of the Employee Name.
B) Find first 5 characters of the Employee Name
C) Left Padding the Employee Name upto 15 characters.
D) Right Padding the Employee Name upto 15 characters.
Answer:A)
B)
Q5) Display the highest, lowest, sum and average salary of all employees. Label the columns
MAXIMUM, MINIMUM, SUM and AVERAGE respectively. Round your result to the nearest
whole number. Save your SQL Statement in a text file as Prog 3_7.sql
Answer:

Q6)Modify the query in Prog 3_7.sql to display the maximum, minimum, sum and average salary for
each job type. Resave as Prog 3_8.sql.
Answer:
PROGRAM 5

Aim : Joins In the SQL

Using the above tables solve the following queries:


Q1)Write a query to find those customers with their name and those salesmen with their name and city
who lives in the same city.
Answer :

Q2) Write a SQL statement to find the names of all customers along with the salesmen who works for
them.
Answer:

Q3) Write a SQL statement to display all those orders by the customers not located in the same cities
where their salesmen live.
Answer:
Q4)Write a SQL statement that finds out each order number followed by the name of the customers
who made the order.
Answer:

Q5) Write a SQL statement that sorts out the customer and their grade who made an order. Each of the
customers must have a grade and served by at least a salesman, who belongs to a city.

Q6) Write a query that produces all customers with their name, city, salesman and commission, who
served by a salesman and the salesman works at a rate of the commission within 12% to 14%.
Q7)Write a SQL statement that produces all orders with the order number, customer name, commission
rate and earned commission amount for those customers who carry their grade is 200 or more and
served by an existing salesman.

Q8) Write a SQL statement to make a list in ascending order for the customer who works either through
a salesman or by own.
PROGRAM 6
AIM : SubQueries in SQL

The given tables are: -


Department: -

Employees_Karan:-
Q1)Write a subquery to find all employees who locate in the location with the id 1700.

Q2)Write a subquery to find the employees who have the highest salary.

Q3)Write a subquery to find all employees who salaries are greater than the average salary of all
employees.

You might also like