You are on page 1of 2

Demonstration tables:

Oracle provides demonstration tables

(i) EMP is a demo table which contains 8 columns and 14 records


Empno number(4)
Ename varchar2(10)
Job varchar2(9)
Mgr number(4)
Hiredate date
Sal number(7,2)
Comm number(7,2)
Deptno number(2)

(ii) DEPT is demo table which contains 3 columns and 4 records


Deptno number(2)
Dname varchar2(14)
Loc varchar2(13)

(iii) SALGRADE is demo table which contains 3 columns and 5 records


Grade number
Losal number
Hisal number

SQL*PLUS Environment

This environment is developed by oracle corporation used to execute the sql statements
against the oracle database
2 types of sql*plus environments can be used
(i) sqlplus.exe (dos environment)
(ii) sqlplusw.exe (windows environment)

these files are existing in the folder


<oracle home directory>\bin \sqlplus.exe or sqlplusw.exe

<oracle home directory> is


<drive>:\oracle\ora__

provide the following parameters to connect to the oracle database

user name : SCOTT


password : TIGER
HOST STRING : ORACLE/SERVER

<USER NAME>/<PASSWORD>@<HOST STRING>

SQL*PLUS COMMAND
These are the commands developed by oracle corporation used to work with the sql*plus
environment

Sql> CL[EAR] SCR[EEN]


It is a sql*plus command used to clear the screen

Sql> DESC[RIBE] <Table name>


It is a sql*plus command used to display the column description of the
table(i.e. column names and their data types)

SQL> desc emp


Name Null? Type
----------------- -------- ------------
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)

SQL> desc dept


Name Null? Type
----------------- -------- ------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)

SQL> desc salgrade


Name Null? Type
----------------- -------- ------------
GRADE NUMBER
LOSAL NUMBER
HISAL NUMBER

sql> EXIT/QUIT
It is a sql*plus command used to disconnect from oracle

Note: to get the demonstration tables execute the script in the file demobld.sql. this file
is existing in the directory
<oracle home directory>\sqlplus\demo\demobld.sql>

Sql> EXECUTE <file name with path>


It is a sql*plus command used to run the script in a file
Sql>execute d:\oracle\ora90\sqlplus\demo\demobld.sql

Sql> @ <file name with path>


Same as EXECUTE
Sql> @ d:\oracle\ora90\sqlplus\demo\demobld.sql

Note:
[] means optional
<> means user defined value

You might also like