0% found this document useful (0 votes)
5 views

Oneshot

The document contains a SQL session demonstrating various operations on an Oracle Database, including querying, deleting, and rolling back records in the 'emp' table. It also shows the creation of a new 'shoes' table, inserting records into it, and displaying the contents of both tables. The operations illustrate basic SQL commands and their effects on the database.

Uploaded by

sachinjainar18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Oneshot

The document contains a SQL session demonstrating various operations on an Oracle Database, including querying, deleting, and rolling back records in the 'emp' table. It also shows the creation of a new 'shoes' table, inserting records into it, and displaying the contents of both tables. The operations illustrate basic SQL commands and their effects on the database.

Uploaded by

sachinjainar18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

SQL*Plus: Release 11.2.0.1.

0 Production on Thu Apr 17 14:40:11 2025

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Enter user-name: SCOTT


Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> set lines 100 pages 100;


SQL> select * from emp;

EMPNO ENAME JOB MGR HIREDATE SAL COMM


DEPTNO
---------- --------------- --------- ---------- --------- ---------- ----------
----------
7369 SMITH CLERK 7902 17-DEC-80 800
20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300
30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500
30
7566 JONES MANAGER 7839 02-APR-81 2975
20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400
30
7698 BLAKE MANAGER 7839 01-MAY-81 2850
30
7782 CLARK MANAGER 7839 09-JUN-81 2450
10
7788 SCOTT ANALYST 7566 19-APR-87 3000
20
7839 KING PRESIDENT 17-NOV-81 5000
10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0
30
7876 ADAMS CLERK 7788 23-MAY-87 1100
20
7900 JAMES CLERK 7698 03-DEC-81 950
30
7902 FORD ANALYST 7566 03-DEC-81 3000
20
7934 MILLER CLERK 7782 23-JAN-82 1300
10

14 rows selected.

SQL> DELETE FROM emp


2 WHERE empno='7839';

1 row deleted.

SQL>
SQL> select * from emp;

EMPNO ENAME JOB MGR HIREDATE SAL COMM


DEPTNO
---------- --------------- --------- ---------- --------- ---------- ----------
----------
7369 SMITH CLERK 7902 17-DEC-80 800
20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300
30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500
30
7566 JONES MANAGER 7839 02-APR-81 2975
20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400
30
7698 BLAKE MANAGER 7839 01-MAY-81 2850
30
7782 CLARK MANAGER 7839 09-JUN-81 2450
10
7788 SCOTT ANALYST 7566 19-APR-87 3000
20
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0
30
7876 ADAMS CLERK 7788 23-MAY-87 1100
20
7900 JAMES CLERK 7698 03-DEC-81 950
30
7902 FORD ANALYST 7566 03-DEC-81 3000
20
7934 MILLER CLERK 7782 23-JAN-82 1300
10

13 rows selected.

SQL> DELETE FROM emp


2 WHERE empno in('7369','7499','7521');

3 rows deleted.

SQL>
SQL> select * from emp;

EMPNO ENAME JOB MGR HIREDATE SAL COMM


DEPTNO
---------- --------------- --------- ---------- --------- ---------- ----------
----------
7566 JONES MANAGER 7839 02-APR-81 2975
20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400
30
7698 BLAKE MANAGER 7839 01-MAY-81 2850
30
7782 CLARK MANAGER 7839 09-JUN-81 2450
10
7788 SCOTT ANALYST 7566 19-APR-87 3000
20
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0
30
7876 ADAMS CLERK 7788 23-MAY-87 1100
20
7900 JAMES CLERK 7698 03-DEC-81 950
30
7902 FORD ANALYST 7566 03-DEC-81 3000
20
7934 MILLER CLERK 7782 23-JAN-82 1300
10

10 rows selected.

SQL> DELETE FROM emp;

10 rows deleted.

SQL> select * from emp;

no rows selected

SQL> rollback;

Rollback complete.

SQL> select * from emp;

EMPNO ENAME JOB MGR HIREDATE SAL COMM


DEPTNO
---------- --------------- --------- ---------- --------- ---------- ----------
----------
7369 SMITH CLERK 7902 17-DEC-80 800
20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300
30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500
30
7566 JONES MANAGER 7839 02-APR-81 2975
20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400
30
7698 BLAKE MANAGER 7839 01-MAY-81 2850
30
7782 CLARK MANAGER 7839 09-JUN-81 2450
10
7788 SCOTT ANALYST 7566 19-APR-87 3000
20
7839 KING PRESIDENT 17-NOV-81 5000
10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0
30
7876 ADAMS CLERK 7788 23-MAY-87 1100
20
7900 JAMES CLERK 7698 03-DEC-81 950
30
7902 FORD ANALYST 7566 03-DEC-81 3000
20
7934 MILLER CLERK 7782 23-JAN-82 1300
10

14 rows selected.

SQL> create table shoes


2
SQL> 9
SP2-0226: Invalid line number
SQL> create table shoes
2 (shoeid number(3) primary key,
3 brand varchar(20) not null unique);

Table created.

SQL> select * from tab;

TNAME TABTYPE CLUSTERID


------------------------------ ------- ----------
ANIMALS TABLE
AUTHORS TABLE
BONUS TABLE
BOOKS TABLE
DEPARTMENT TABLE
DEPT TABLE
DEPTDETAILS TABLE
EMP TABLE
EMPTWICE TABLE
FOOD TABLE
FOREST TABLE
LEO TABLE
MART TABLE
PRICE TABLE
SALGRADE TABLE
SHOES TABLE

16 rows selected.

SQL> describe shoes;


Name Null? Type
----------------------------------------------------- --------
------------------------------------
SHOEID NOT NULL NUMBER(3)
BRAND NOT NULL VARCHAR2(20)

SQL> select * from shoes;

no rows selected

SQL> insert into shoes values('1','adidas');

1 row created.

SQL> insert into shoes values('2','puma');

1 row created.

SQL> select * from shoes;

SHOEID BRAND
---------- --------------------
1 adidas
2 puma

SQL>

You might also like