You are on page 1of 23

The presentation on

Developed By

- Dalwadi manish.

  SUBMITTED TO
 
----------
Types to start SQL*Plus

 Dos Base
 In isql*plus
 Using SQL*Plus
Dos Base
For Starting Sql*Plus in
“Dos” We have to Just Write
down in Dos :=

sqlplus
For Ex :=

C:\Document and Setting\ssit>sqlplus


SQl In isqlplus

SQL Also start with isqlplus.

For start isqlplus we have to open Web Browser (Internet


Explorer).

After opening internet explorer we just write down

http://localhost/isqlplus
After writing this link in link bar
Isqlplus is start.
In isql*plus we can easily
save our data.

SELECT last_name, hire_date, salary


FROM employees; 1

2
And Easily load our data.

D:\temp\emp_sql

SELECT last_name, hire_date, salary 2


FROM employees;

3
Using SQl*Plus
SQL start using SQL*Plus.

In SQL*Plus Different types of username &


Passwords.

SystemDatabas
User name = scott e

Password = tiger

Uname = /as sysdba


Uname = system
Password = admin
Create User

In SQL*Plus create our own user .

We have to just login to /as sysdba .

/as sysdba is mostly used For any insertion, updation,


deletion about user

SQL>CONNECT /AS SYSDBA;


SQL>CREATE USER SSIT IDENTIFIED BY SSIT;

Username Password
Grant
After create user we have to give a permission to use and
connect this user.

For giving a permission tothis user we have to write down :=

Ex := Used for granting

SQL>grant resource, connect to ssit;

OR
SQL>grant create session, create table, create procedure,
2 create sequence, create view, create trigger to ssit;
Revoke

Privileges once given can be denied to a user using the


REVOKE command.

The object owner can revoke priveleges granted to another


user.

A user of an object who is not the owner, but has been


granted the grant priveleges, has the power to REVOKE the
priveleges from a grantee.

Revoking Permission Using the REVOKE statement.


SQL>revoke resource, connect from ssit;

OR
SQL>revoke create session, create table, create procedure,
2 create sequence, create view, create trigger to ssit;
Lock & Unlock User

If we want to lock on our user account


Then

SQL>alter user ssit account lock;

When we want to unlock our user account then

SQL>alter user ssit account unlock;


Display Tables

In SQL*Plus see all tables we are write down

SQL> select * from tab;

But
SQL>select table_name from user_tables;

Both are doing same work.


Constraints
There are five types of constraints.

1.Primary key
2.Unique
3.Not Null
4.Check
5.Foreign Key

After giving a any type of constraints in any table

If We want to check that the in which table on a which field we


given a constraints.
First write down this query.

SQL> desc user_constraints;


this query will display all types of conditions and
then u can select and check your constraints.

Like :=
Name
----------------------
OWNER
CONSTRAINT_NAME
CONSTRAINT_TYPE
TABLE_NAME
SEARCH_CONDITION
R_CONSTRAINT_NAME
SQL> select
owner,constraint_name,constraint_type,search_con
dition,table_name from user_constraints;
Constraint_type

OWNER TABLE_NAME CONSTRAINT_NAME C SEARCH_CONDITION


------------- ------------------ ----------------------------- --- -----------------------------------
SCOTT DEPARTMENT PK_DEPTCODE P
SCOTT DEPARTMENT CK_DEPTCODE C deptcode like 'D%'
SCOTT DEPARTMENT UQ_DNAME U
SCOTT DEPARTMENT CK_DHEAD C dhead like 'MR%'
SCOTT DEPARTMENT CK_REGION C regionin

('east','EAST','west','WEST','north','NORTH','south','SOUTH')

SCOTT EMPLOYEE CK_EOJ C edoj>edob


SCOTT EMPLOYEE UQ_EMAIL U
Save Data
In SQL*Plus for saving data
Syntax :=
spool spoolname
Ex :=

SQL>Spool SSITMCA
in spool name space is not required. If space is occur then
Error will be display on screen.
Like :=

SQL>spool SSIT MCA


SP2-0333: Illegal spool file name: "SSIT MCA" (bad character: ' ')
Whenever your work will be complete u have to write down

SQL>spool off

Saving All
Data as any Extension
Save the data as a .csv extension.

Syntax :=
spool drivename:\.csv
Ex :=
Where data you
SQL>spool C:\SSIT.doc have to store ?
Save Each data
If you want to save your data each query wise &
save your data with any extension wise,
Then

SQL>save c:\SSIT.sql
SQL>Save c:\SSIT.doc
SQL>Save c:\SSIT.csv

For comment line use -- symbol.

SQL>--SSIT Records

You might also like