You are on page 1of 47

SYBSC CS SEMESTER III Paper IV DBMS (II)

2017-18
Certificate
Index

Sr. No. Date Topic Sign

1 Create tables and insert tuples

2 Demonstrate the working of


PL/SQL

3 Demonstrate the working of


Conditional Construct and GOTO

4 Demonstrate the working of


While Loop

5 Demonstrate the working of For


Loop

6 Demonstrate the working of


Stored Procedure

7 Demonstrate the working of


Functions

8 Demonstrate the working of


Sequence and Transactional
Locks
Practical No.01

Aim: Write a program to create the following tables:

 Create table Employee containing rows EmpNo, EName, Job, Mgr,Hire Date,
Sal, Comm, DeptNo and insert atleast 10 records.
 Create table Department containing rows DeptNo, DName, Location and
insert atleast 5 records.
 Create table Programmer containing rows Name,Dob,Gender,Prof1,Prof2,
Salary and insert atleast 10 records.
 Create table Software containing rows Name,Title,Dev_In,Scost,Dcost,Sold and
insert atleast 10 records.
 Create table Studies containing rows Name,Splace,Course,Cost and insert
atleast 10 records.

Solution 1:

Employee Table

Code:-
Create Table syemp
(
empno number(4) NOT NULL ,
ename varchar2(10),
job varchar2(9),
mgr number(4),
hiredate date,
sal number(7,2),
comm number(7,2),
deptno number(2)
)

insert into syemp values(7369,'Smith','Clerk',7902,'17-Dec-80',800,20,55)

insert into syemp values(7499,'Allen','Salesman',7698,'20-Feb-81',1600,300,30)

insert into syemp values(7521,'Ward','Salesman',7698,'22-Feb-81',1250,500,30)

insert into syemp values(7566,'Jonies','Manager',7839,'02-Apr-81',2975,20,30)


insert into syemp values(7654,'Martin','Salesman',7698,'28-Sep-81',1250,1400,30)

insert into syemp values(7698,'Blake','Manager',7839,'01-May-81',2850,30,65)

insert into syemp values(7782,'Clark','Manager',7839,'09-Jun-81',2450,10,30)

insert into syemp values(7788,'Scott','Analyst',7566,'19-Apr-87',3000,20,30)

insert into syemp values(7839,'King','President',1555,'17-Nov-81',5000,10,30)

insert into syemp values(7844,'Turner','Salesman',7698,'08-Sep-81',1500,0,30)

Select * from syemp;

Output:

SQL> Select * from syemp;

EMPNO ENAME JOB MGR HIREDATE SAL COMM


---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7369 Smith Clerk 7902 17-DEC-80 800 20
55

7499 Allen Salesman 7698 20-FEB-81 1600 300


30

7521 Ward Salesman 7698 22-FEB-81 1250 500


30

EMPNO ENAME JOB MGR HIREDATE SAL COMM


---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7566 Jonies Manager 7839 02-APR-81 2975 20
30

7654 Martin Salesman 7698 28-SEP-81 1250 1400


30
7698 Blake Manager 7839 01-MAY-81 2850 30
65

EMPNO ENAME JOB MGR HIREDATE SAL COMM


---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7782 Clark Manager 7839 09-JUN-81 2450 10
30

7788 Scott Analyst 7566 19-APR-87 3000 20


30

7839 King President 1555 17-NOV-81 5000 10


30

EMPNO ENAME JOB MGR HIREDATE SAL COMM


---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7844 Turner Salesman 7698 08-SEP-81 1500 0
30

10 rows selected.

Solution 2:

Department Table

Code:-
Create Table sydept
(
deptno number(2) NOT NULL,
dname varchar2(14),
loc varchar2(13)
)

insert into sydept values(10,'Accounting','New York')


insert into sydept values(20,'Research','Dallas')

insert into sydept values(30,'Sales','Chicago')

insert into sydept values(40,'Operations','Boston')

Output:-

Select * from sydept;

Solution 3:

Programmer Table

Code:-
Create Table syprogrammer
(
name varchar2(8) primary key NOT NULL ,
dob date NOT NULL ,
doj date NOT NULL ,
sex varchar2(1) NOT NULL ,
prof1 varchar2(8),
prof2 varchar2(8),
salary number(4) NOT NULL
)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Anand','21-Apr-66','21-Apr-92','M','PASCAL','BASIC',3200)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Altaf','02-Jul-64','13-Nov-90','M','CLIPPER','COBOL',2800)
insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)
values('Jagdesh','06-Oct-70','04-Oct-94','M','ORACLE','JAVA',4100)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Juliana','31-Jan-68','21-Apr-90','F','COBOL','DBASE',3000)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Kamala','30-Oct-68','02-Jan-92','F','C','DBASE',2900)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Mary','24-June-70','01-Feb-91','F','C++','ORACLE',4500)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Nelson','11-Sep-65','11-Oct-89','M','COBOL','DBASE',2500)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Patrick','19-Nov-65','21-Apr-90','M','PASCAL','CLIPPER',2800)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Qadir','31-Aug-65','21-Apr-93','M','ASSEMBLY','C',3000)

insert into syprogrammer(name,dob,doj,sex,prof1,prof2,salary)


values('Ramesh','03-May-67','28-Feb-91','M','PASCAL','DBASE',3200)

Output:-

Select * from syprogrammer;


Solution 4:

Studies Table

Code:-

Create Table systudies


(
name varchar2(8) Not Null ,
splace varchar2(9) Not Null ,
course varchar2(5) ,
cost number(5)
)

insert into systudies(name,splace,course,cost)


values('Anand','Sabhari','PGDCA',4500)

insert into systudies(name,splace,course,cost)


values('Altaf','Ccit','DCA',7200)

insert into systudies(name,splace,course,cost)


values('Jagdesh','S.S.I.L','DCA',3500)

insert into systudies(name,splace,course,cost)


values('Juliana','BITS','DCA',22000)

insert into systudies(name,splace,course,cost)


values('Kamala','Paragathi','DCP',5000)

insert into systudies(name,splace,course,cost)


values('Mary','Sabhari','PGDCA',4500)

insert into systudies(name,splace,course,cost)


values('Nelson','Pragathi','DAP',6200)

insert into systudies(name,splace,course,cost)


values('Patrick','Pragathi','DCAP',5200)

insert into systudies(name,splace,course,cost)


values('Qadir','Apple','HDCP',14000)

insert into systudies(name,splace,course,cost)


values('Ramesh','Sabhari','PGDCA',4500)
Output:-

Solution 5:

Software Table

Code:-
Create Table sysoftware
(
name varchar2(8) Not Null,
title varchar2(20) Not Null,
dev_in varchar2(8) Not Null,
scost number(7,2),
dcost number(5),
sold number(3)
)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Anand','Parachutes','Basic',399.95,6000,43)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Anand','Video Titiling Pack','Pascal',7500,16000,9)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Jagdesh','Serial Link Utility','Java',800,7500,10)
insert into sysoftware(name,title,dev_in,scost,dcost,sold)
values('Jagdesh','Shares Management','Oracle',3000,12000,14)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Juliana','Inventory Control','Cobol',3000,3500,0)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Kamala',' Payroll Package','DBase',9000,20000,7)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Mary','FinancialAcc S/W','Oracle',18000,85000,4)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Mary','Code Generator','C',4500,20000,23)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Mary','ReadMe','C++',300,1200,84)

insert into sysoftware(name,title,dev_in,scost,dcost,sold)


values('Patrick','Graphic Editior','Pascal',750,5000,11)

Output:-
Practical No: 02

Aim: Write a Pl/SQl block to perform the following operation

 To find the Addition,Sutraction,Multiplication,Division of two number.


 To calculate the area of triangle.
 Calculate area and perimeter of circle.
 To print odd number from 1-50

Solution

Ans1:

declare

a number;

b number;

c number;

begin

dbms_output.put_line('Enter the value of a’);

a:=&a;

dbms_output.put_line('Enter the value of b’);

b:=&b;

c:=a+b;

dbms_output.put_line('Value for a is = '|| a);

dbms_output.put_line('Value for b is = '|| b);

dbms_output.put_line('Addition of a and b is = '|| c);

end;

Output:
Ans3:

declare

l number;

b number;

area number;

begin

dbms_output.put_line(‘Enter the length of triangle’);

l:=&l;

dbms_output.put_line(‘Enter the breadth of triangle’);

b:=&b;

area:=0.5*l*b;

dbms_output.put_line('Value of length is = '|| l);

dbms_output.put_line('Value of breadth is = '|| b);

dbms_output.put_line('area of triangle= '|| area);

end;

output:
Ans4:

declare

r number:=5;

area number(5,2);

peri number(5,2);

begin

area:=3.14*r*r;

peri:=2*3.14*r;

dbms_output.put_line('Radius= '|| r);

dbms_output.put_line('Area of a circle= '|| area);

dbms_output.put_line('Circumference/Perimeter of the Circle = '|| peri);

end;

output:
declare

n number := 1;

begin

while n<=30

loop

dbms_output.put_line(n);

n := n+2;

end loop;

end;

/
Practical No:03

Aim: Write Pl/SQl block which displays the use of conditional construct and
the use of GOTO statements

 Enter a number from Key board. If it is not zero print 'natural number',
else print 'enter wrong number.
 Calculate the net salary where DA is 30% of basic, HRA is 10% of basic
and PF IS 7% of basic salary if salary is less than 8000 ,PF is 10% if
basic sal between 8000 to 160000.
 Find the greatest among three numbers.
 Print the numbers from 1-20 using GOTO statements

Solution

Ans1:

Code:-
DECLARE
num number;
BEGIN
dbms_output.put_line(‘Enter number’);
num:=&num;
If(num>0) THEN
dbms_output.put_line(num || ' Natural Number ');
ELSE
dbms_output.put_line(num|| ' Not A Natural Number ');
END If;
END;

OUTPUT:-

Ans2:
Code:-
DECLARE
ename varchar2(15);
basic number;
da number;
hra number;
pf number;
netsalary number;
BEGIN
ename:='GAURAV';
basic:=9000;
da:=basic*(30/100);
hra:=basic*(10/100);
if(basic<8000)
then
pf:=basic*(8/100);
elsif(basic>=8000 and basic <= 16000)
then
pf:=basic*(10/100);
end if;
netsalary:=basic+da+hra-pf;

dbms_output.put_line('Employee Name: ' || ename);


dbms_output.put_line('Providend Fund: ' || pf);
dbms_output.put_line('Net Salary: ' || netsalary);
END;

Ans: 3

Code:-
DECLARE
a number;
b number;
c number;
BEGIN
a:=3;
dbms_output.put_line('Enter a: ' || a);
b:=6;
dbms_output.put_line('Enter b: ' || b);
c:=9;
dbms_output.put_line('Enter c: ' || c);
if(a>b and a>c)
then
dbms_output.put_line(a || ' is a greater number ');
elsif(b>a and b>c)
then
dbms_output.put_line(b || ' is a greater number ');
else
dbms_output.put_line(c || ' is a greater number ');
end if;
END;

OUTPUT:-
9 is a greater number

Ans 4

SQL> DECLARE
2 counter NUMBER := 1;
3 BEGIN
4 WHILE (counter < 5) LOOP
5 IF counter = 2 THEN
6 GOTO cp;
7 ELSE
8 dbms_output.put_line(‘counter’ ['||counter||'].');
9 END IF;
10.<<cp>>
11 IF counter >= 1 THEN
12 counter := counter + 1;
13 END IF;
14 END LOOP;
15 END;
Practical No:04

Aim: Write a program which displays the use of while loop

 Write a program to reverse a number.eg 123 to 321


 Program to check whether the given number is palindrome or not.
 Program to count number of digits in an integer using loop(eg- n=3452
no of digits=4)
 Check a no amstrong or not (An Armstrong number of three digits is an
integer such that the sum of the cubes of its digits is equal to
the number itself. For example, 371 is an Armstrong number since 3**3
+ 7**3 + 1**3 = 371)
Solution

Ans1:
Ans3:

Ans4:
Practical No.05

Aim: Write a program which displays the use of FOR loop

 Print Fibonacci Series like 0,1,1,2,3....


 Evaluate Prime number between 1..100
 Calculate Factorial of a number like 4!=4*3*2*1
 Program to find HCF of two numbers (HCF is also called as GCD)

Solution

Ans1:
Ans2:

Ans3:
Ans4:
Practical No.:-06 Stored Procedure

Aim: Write programs to demonstrate the working of stored


procedures

 Create a procedure with number type as a parameter and display the


value in it.

 Create table dept and then create a procedure to add a new record
into the dept table. The appropriate columns belonging to the table
are:

 dno number
 name varchar2
 location varchar2

 Write a proc that returns the salary of the employee given his name as
IN parameter.

 Write a procedure to multiply, subtract, add, divide two numbers.

 Create three procedures and call them one by one to determine and
conclude about the scope of each procedure

Procedure with In Parameters


Procedures with OUT parameter:

Write a proc that returns the salary of the employee given his name as IN
parameter.
Swap two numbers

Multiply two numbers


Subtract
Practical No:- 07 Function

Aim: Write programs to demonstrate the working of functions

Write a function to find maximum of two numbers.


Accept 3 different numbers from the user and create a function to display
them in ascending order.

Accept 3 different numbers from the user and create a function to display them in
descending order.

1 create or replace function desc469(a in number,b in number,c in


number)return varchar2
2 is
3 begin
4 if a>b and b>c then
5 return 'The sequence is '||a||' '||b||' '||c;
6 elsif b>a and a>c then
7 return 'The sequence is '||b||' '||a||' '||c;
8 elsif b>c and c>a then
9 return 'The sequence is '||b||' '||c||' '||a;
10 elsif a>c and c>b then
11 return 'The squence is '||a||' '||c||' '||b;
12 elsif c>a and a>b then
13 return 'The squence is '||c||' '||a||' '||b;
14 elsif c>b and b>a then
15 return 'The squence is '||c||' '||b||' '||a;
16 end if;
17 end desc469;
SQL> /
Function created.
SQL> variable x varchar2(40);
SQL> begin
2 :x:=desc469(1,20,2);
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> print :x;
X
----------------------------------------
The sequence is 20 2 1

Write a function to check whether the number passed as an argument is


even or odd.
Create a table Customer with following attributes:
CUST_ID VARCHAR2(4), CUST_NAME
VARCHAR2(20) CUST_ADDR VARCHAR2(20) CUST_TELNO NUMBER(10)
Insert 5 meaningful records in it. Create a function which will count the
total number of customers from the Customer table.

SQL> create table cust483(cust_id varchar2(10),cust_name


varchar2(15),address varchar2(30),Tel_no number(12));

Table created.

SQL> insert into cust483


values('&cust_id','&cust_name','&address',&Tel_no);

SQL> select * from cust483;

CUST_ID CUST_NAME ADDRESS TEL_NO

---------- --------------- ------------------------------ ---------


-

101 vaishali sion 9029123

102 shafaque wadala 9029456

103 suchita sion 123456

104 sapna wadala 4567328

105 maya dahisar 32434343

5 rows selected.

1 create or replace function count469 return number

2 is

3 a number;

4 begin

5 select count(*) into a from cust483;

6 return a;

7* end count469;

SQL> /

Function created.
1 begin

2 :x:=count469;

3* end;

2. Create a table Book with following attributes:


a. BK_ID VARCHAR2(5)

b. BK_NAME VARCHAR2(10)

c. AUTHOR VARCHAR2(20)

d. PUBLSHR VARCHAR2(20)

e. EDITION VARCHAR2(20)

f. Insert 5 meaningful records in it.Create a function which will


count the total number of Books and store the return value to a
variable.

SQL> create table books469(bk_id varchar2(5),bk_name


varchar2(10),author varchar2(20),publshr varchar2(20),edition
varchar2(20));

Table created.

SQL>insert into books469


values('&bk_id','&bk_name','&author','&publshr','&edition');

1 create or replace function count483 return number

2 is

3 a number;

4 begin

5 select count(*) into a from books469;

6 return a;

7* end count483;

SQL> /
Function created.

SQL> variable y number;

SQL> begin

2 :y:=count483;

3 end;

4 /

PL/SQL procedure successfully completed.

SQL> print :y;

----------

Create a function which will compute the square and cube of a number.
Write a pl/SQL block which acts as a recursive function which
computes factorial of a number.
1 create or replace function fact(n in number) return number
2 is
3 begin
4 if n=1 then
5 return 1;
6 else
7 return n*fact (n-1);
8 end if;
9 end fact;
10 /

Function created.
SQL> variable a number;
SQL> begin
2 :a:=fact(4);
3 end;
4/

PL/SQL procedure successfully completed.

SQL> print :a

A
----------
24
Practical No.:-08 Transaction Locks And Sequence

Questions:-

1. Create a table ticket with following fields ticket id, name, source and destination
address. Insert atleast 5 records in it. Create a savepoint and now insert single
record in it. See all the records and now rollback to savepoint.
2. Create two tables EMP and Customer. EMP table should have the following fields
–EMP id, name, salary and bonus whereas Customer table must have cid, name,
and purchase as fields. Insert atleast 5 records in each table and perform the
following transaction.
i. Update EMP by increasing the salary of all employees by 5000.
ii. Increase the bonus of specified employee by 1000.
iii. Commit the EMP transaction.
iv. Update Customer table by increasing the purchase by 1000 for specified
customer.
v. Rollback the Customer Transaction.
3. Create a sequence with default values. Insert atleast 2 records in the Customer
table by using sequence.
4. Alter the sequence increment by 2 and cache as 2. Insert record in Customer table
and see the result.
5. Alter the maximum value of sequence to 10, cache 2 and cycle option to start
again from the starting value. Insert record in Customer table to see the changes.
6. Create sequence with maximum value 4 and no cycle option. Insert 5 records in
EMP table to see working of sequence.
Solution:-

1. CREATE TABLE TICKET


(
T_ID NUMBER,
NAME VARCHAR (10),
SOURCE VARCHAR (15),
DEST_ADD VARCHAR (25)
);

INSERT INTO TICKET VALUES (1,'PRAMILA','BANDRA',' ANDHERI');


SELECT * FROM TICKET;

T_ID NAME SOURCE DEST_ADD

1 PRAMILA BANDRA ANDHERI

2 PRIYANKA LOWER PAREL DADAR

3 TRUPTI MAHIM DADAR

4 PRITI CHEMBUR GOREGAON

5 PRANITA BORIWALI VILEPARLE

DECLARE

BEGIN

SAVEPOINT S1;

INSERT INTO TICKET VALUES (6,'SNEHAL','PAREL', 'MATUNGA');

END;

PL/SQL procedure successfully completed

SELECT * FROM TICKET;

Output:-

T_ID NAME SOURCE DEST_ADD

1 PRAMILA BANDRA ANDHERI

2 PRIYANKA LOWER PAREL DADAR

3 TRUPTI MAHIM DADAR


4 PRITI CHEMBUR GOREGAON

5 PRANITA BORIWALI VILEPARLE

6 SNEHAL PAREL MATUNGA

ROLLBACK TO SAVEPOINT S1;

ROLLBACK COMPLETED

SELECT * FROM TICKET;

Output:-

T_ID NAME SOURCE DEST_ADD

1 PRAMILA BANDRA ANDHERI

2 PRIYANKA LOWER PAREL DADAR

3 TRUPTI MAHIM DADAR

4 PRITI CHEMBUR GOREGAON

5 PRANITA BORIWALI VILEPARLE

2. CREATE TABLE EMP01

EMP_ID NUMBER (4, 0),

E_NAME VARCHAR (15),

SALARY NUMBER (7, 2),

BONUS NUMBER (5, 2)

);

INSERT INTO EMP01 VALUES (001,'ARATI', 15000, 1000);

SELECT * FROM EMP01;

EMP_ID E_NAME SALARY BONUS

001 ARATI 15000 1000

002 SONALI 20000 2000

003 CHAITALI 25000 3000


004 CHAITRALI 30000 4000

005 SANDHYA 35000 5000

CREATE TABLE CUSTOMER

C_ID NUMBER (4, 0),

C_NAME VARCHAR (15),

PURCHASE NUMBER (7, 2)

);

INSERT INTO CUSTOMER VALUES (101,'NIDHI', 15000);

SELECT * FROM CUSTOMER;

C_ID C_NAME PURCHASE

1 NIDHI 5

2 SADHANA 10

3 TEJASHREE 15

4 RUTUJA 20

5 GAURI 25

SAVEPOINT S2;

i. UPDATE EMP01 SET SALARY=SALARY+5000;

Output:-

SELECT * FROM EMP01;

EMP_ID E_NAME SALARY BONUS

001 ARATI 20000 1000

002 SONALI 25000 2000

003 CHAITALI 30000 3000

004 CHAITRALI 35000 4000

005 SANDHYA 40000 5000


ii. UPDATE EMP01 SET BONUS=BONUS+100 WHERE EMP_ID=001;

Output:-

EMP_ID E_NAME SALARY BONUS

001 ARATI 20000 2000

iii. COMMIT;

Output:-

COMMIT COMPLETED;

SELECT * FROM EMP01;

EMP_ID E_NAME SALARY BONUS

001 ARATI 20000 2000

002 SONALI 25000 2000

003 CHAITALI 30000 3000

004 CHAITRALI 35000 4000

005 SANDHYA 40000 5000

iv.

begin

create savepoint s2;

UPDATE CUSTOMER SET PURCHASE=PURCHASE+1000

WHERE C_ID=101;

End;

Output:-

SELECT * FROM CUSTOMER;

C_ID C_NAME PURCHASE

101 NIDHI 1005

vi. ROLLBACK TO SAVEPOINT S2;

Output:-
ROLLBACK COMPLETED.

SELECT * FROM CUSTOMER;

C_ID C_NAME PURCHASE

1 NIDHI 5

2 SADHANA 10

3 TEJASHREE 15

4 RUTUJA 20

5 GAURI 25

3. CREATE SEQUENCE S2;

SEQUENCE CREATED.

INSERT INTO CUSTOMER VALUES (S2.NEXTVAL,'PRIYANKA', 15000);

INSERT INTO CUSTOMER VALUES (S2.NEXTVAL,'TRUPTI', 20000);

Output:-

SELECT * FROM CUSTOMER;

C_ID C_NAME PURCHASE

1 NIDHI 5

2 SADHANA 10

3 TEJASHREE 15

4 RUTUJA 20

5 GAURI 25

6 PRIYANKA 15000

7 TRUPTI 20000

4. ALTER SEQUENCE S2
INCREMENT BY 2

CACHE 2;

INSERT INTO CUSTOMER VALUES (S2.NEXTVAL,'APARNA', 25000);

INSERT INTO CUSTOMER VALUES (S2.NEXTVAL,'RUCHIRA', 35000);

SEQUENCE ALTERED.

Output:-

SELECT * FROM CUSTOMER;

C_ID C_NAME PURCHASE

1 NIDHI 5

2 SADHANA 10

3 TEJASHREE 15

4 RUTUJA 20

5 GAURI 25

6 PRIYANKA 15000

7 TRUPTI 20000

9 APARNA 25000

11 RUCHIRA 35000

13 ASMI 40000

5. ALTER SEQUENCE S2

MAXVALUE 10

CACHE 2

CYCLE;

INSERT INTO CUSTOMER VALUES (S2.NEXTVAL,'SHRADDHA', 45000);

Output:-

SELECT * FROM CUSTOMER;


C_ID C_NAME PURCHASE

1 NIDHI 5

2 SADHANA 10

3 TEJASHREE 15

4 RUTUJA 20

5 GAURI 25

6 PRIYANKA 15000

7 TRUPTI 20000

9 APARNA 25000

9 APARNA 25000

11 RUCHIRA 35000

1 SHRADDHA 45000

6. CREATE SEQUENCE S3

MAXVALUE 4

NOCYCLE;

INSERT INTO EMP01 VALUES (S3.NEXTVAL,'AKSHATA', 50000, 5000);

Output:-

SEQUENCE CREATED.

SELECT * FROM EMP01;

EMP_ID E_NAME SALARY BONUS

001 ARATI 15000 1000

002 SONALI 20000 2000

003 CHAITALI 25000 3000

004 CHAITRALI 30000 4000

005 AKSHATA 50000 5000


006 POOJA 60000 6000

007 DURVA 70000 7000

008 NEHA 80000 8000

009 SAYALI 90000 9000

You might also like