Vous êtes sur la page 1sur 7

Relational Database Management Systems Lab #01

LAB #01
OVERVIEW OF SQL

OBJECTIVE
To learn the features of SQL and SQL* Plus commands

THEORY
SQL (Structured Query Language)
SQL is the industry standard language for relational databases. All RDBMS support
some form of SQL and most RDBMS vendors intend to comply with the ANSI
standard known as SQL-92.
SQL is a command language for communication with the Oracle 7 Server from any
tool or application. Oracle SQL has many extensions.

SQL*PLUS:
SQL *Plus is an Oracle tool that recognizes and submits SQL and PL/SQL statements
to the server for execution, and contains its own command language.

A p p l i c a t i o n
S Q L P l u s
S Q L
O r a c l e
O p e r a t i n g
S y s t e m

D A T A

Fig 1.1 Interaction of SQL with O/S

Overview Of SQL 1
Relational Database Management Systems Lab #01

SQL*PLUS

BUFFER
User

Fig 1.2
Interaction of SQL & SQL*Plus

A LANGUAGE FOR ALL USERS


SQL is used for all types of database activities by all types of users including:

♦ System administrators
♦ Database administrators
♦ Security administrators
♦ Application programmers
♦ Decision support system personnel
♦ Many other types of end users

SQL provides commands for a variety of tasks including:


♦ Querying data
♦ Inserting, updating, and deleting rows in a table
♦ Creating, replacing, altering, and dropping objects
♦ Controlling access to the database and its objects
♦ Guaranteeing database consistency and integrity

SUMMARY OF SQL COMMAND


♦ Data Definition Language commands
♦ Data Manipulation Language commands
♦ Data Control Language
♦ Data Query Language
♦ Session Control command
♦ System Control commands
♦ Embedded SQL commands

Overview Of SQL 2
Relational Database Management Systems Lab #01

DATA DEFINITION LANGUAGE (DDL)


Sets up, changes, and removes data structures from tables, collectively known as Data
Definition Commands
♦ Create
♦ Drop
♦ Alter
♦ Rename
♦ Truncate

DATA MANIPULATION LANGUAGE (DML)


Enter new rows, changes existing rows and removes unwanted rows from the tables in
the database, respectively collectively known as Data manipulation commands
♦ Insert
♦ Update
♦ Delete

SELECT QUERY
Retrieves data from the database. Most commonly used command

DATA CONTROL LANGUAGE(DCL)


Gives or removes access rights to both the Oracle database and the structures with in
it. Collectively known as Data Control Language
♦ Grant
♦ Revoke
♦ Commit
♦ Rollback
♦ Save point

BASIC CONCEPTS

Command
An instruction you give SQL*Plus or Oracle.

Block
A group of SQL and PL/SQL commands related to one another through procedural
logic.

Table
The basic unit of storage in Oracle

Overview Of SQL 3
Relational Database Management Systems Lab #01

Query
A SQL command

Query Result
Retrieves data from the database. Most commonly used command

Report
Query results formatted by You through SQL*Plus commands.

SAMPLE TABLES
Many of the concepts and operations in this Guide are illustrated by a set of sample
tables. These tables contain personnel records for a fictitious company.
The exercises make use of the information in two sample tables:

Emp
Contains information about the employees of the Sample Company.

Dept
Contains information about the departments in the company.

USERNAME AND PASSWORD


When you start SQL*Plus, you will need a username that identifies you as an
authorized Oracle user and a password that proves you are the legitimate owner of
your username. The demonstration username, SCOTT, and password, TIGER, may be
set up on your system during the installation procedure. In this case, you can use the
Oracle username SCOTT and password TIGER with the EMP and DEPT tables.

multi-user Systems (Windows NT 4.0)


If several people share your computer's operating system, your DBA can set up your
SQL*Plus username and password. You will also need a system username and
password to gain admittance to the operating system. These may or may not be the
same ones you use with SQL*Plus.

Overview Of SQL 4
Relational Database Management Systems Lab #01

Fig 1.3 Client Server Architecture

Single-User Systems (Windows 98 )


If only one person at a time uses your computer, you may be expected to perform the
DBA's functions for yourself. In that case, you can use the Oracle username SCOTT
and password TIGER.

STARTING SQL*PLUS.
♦ Make sure that Oracle has been installed on your computer.
♦ Turn on your computer (if it is off) and log on to the host operating system (if
required). If you are already using your computer, you need not log off or reset it.
Simply exit from the program you are using (if any).
♦ Click Sql-Plus menu in the Pop up Menu.

Overview Of SQL 5
Relational Database Management Systems Lab #01

Fig 1.4 Sql Plus Log on screen

♦ Enter your username and press [Return]. SQL*Plus displays the prompt "Enter
password:".
♦ Enter your password and press [Return] again. For your protection, your password
does not appear on the screen.
The process of entering your username and password is called logging in. SQL*Plus
displays the version of Oracle to which you connected and the versions of available
tools such as PL/SQL

Next, SQL*Plus displays the SQL*Plus command prompt

SQL>

ASSIGNMENTS

1. Define the term Database.

2. Define the term Table.

3. What is Block?

4. Define the term Record.

Overview Of SQL 6
Relational Database Management Systems Lab #01

5. How you retrieve data from database?

6. What is Schema?

7. Define Architecture of Oracle.

8. What makes SQL a nonprocedural language?

Overview Of SQL 7

Vous aimerez peut-être aussi