23BCE277 DBMS PR1
23BCE277 DBMS PR1
23BCE277 DBMS PR1
: 23BCE277
NAME: RATHVA DIPESHKUMAR B.
SEMESTER: 3
DIVISION: E
BATCH: E-2
PRACTICAL: 1
CODES:
clientno varchar2 6
name varchar2 20
city varchar2 15
pincode number 8
state varchar2 15
#OUTPUT:
SQL> CREATE TABLE client (
b)
c)
d) clientno VARCHAR2(6),
e) name VARCHAR2(20),
f) city VARCHAR2(15),
g) pincode NUMBER(8),
h) state VARCHAR2(15),
i) baldue NUMBER(10, 5)
j) );
Table created.
productno varchar2 6
description varchar2 15
profitpercent number 4, 2
unitmeasure varchar2 10
qtyonhand number 8
reorderlvl number 8
sellprice number 8, 2
costprice number 8, 2
#OUTPUT:
salesmanname varchar2 20
address1 varchar2 30
address2 varchar2 30
City varchar2 20
pincode number 8
state varchar2 20
salamt number 8, 2
tgttoget number 6, 2
ytdsales number 6, 2
remarks varchar2 60
#OUTPUT:
SQL> CREATE TABLE salesman (
2 salesmanno VARCHAR2(6),
3 salesmanname VARCHAR2(20),
4 address1 VARCHAR2(30),
5 address2 VARCHAR2(30),
6 city VARCHAR2(20),
7 pincode NUMBER(8),
8 state VARCHAR2(20),
9 salamt NUMBER(8, 2),
10 tgttoget NUMBER(6, 2),
11 ytdsales NUMBER(6, 2),
12 remarks VARCHAR2(60)
13 );
Table created.
m) Create table sales_order (used to store client’s orders) having
following attributes:
orderno varchar2 6
clientno varchar2 6
orderdate date
salesmanno varchar2 6
delaytype char 1
Billyn char 1
delaydate date
orderstatus varchar2 10
#OUTPUT:
SQL> CREATE TABLE sales_order (
2 orderno
VARCHAR2(6), 3 clientno
VARCHAR2(6),
4 orderdate DATE,
5 salesmanno VARCHAR2(6),
6 delaytype CHAR(1),
7 billyn CHAR(1),
8 delaydate DATE,
9 orderstatus VARCHAR2(10)
10 );
Table created.
n) Create table sales_order_details (used to store client’s orders with
details of each product ordered ) having following attributes:
Orderno varchar2 6
productno varchar2 6
qtyordered number 8
#OUTPUT:
SQL> CREATE TABLE sales_order_details (
2 orderno VARCHAR2(6),
3 productno VARCHAR2(6),
4 qtyordered NUMBER(8),
5 productrate NUMBER(10, 2)
6 );
Commit complete.
3. a) Insert the following data into client table :
SQL> INSERT INTO client VALUES ('C01', 'Ivan Bayross', 'Mumbai', 400054, 'Maharashtra',
15000);
SQL> INSERT ALL
b)
c)
d) INTO client VALUES ('C02', 'Mamta Shah', 'Chennai', 780001, 'Tamil Nadu', 0)
e) INTO client VALUES ('C03', 'Chhaya Patel', 'Mumbai', 400057, 'Maharashtra', 5000)
f) INTO client VALUES ('C04', 'Ashni Joshi', 'Bangalore', 560001, 'Karnataka', 0)
g) INTO client VALUES ('C05', 'Harsh Desai', 'Mumbai', 400060, 'Maharashtra', 2000)
h) INTO client VALUES ('C06', 'Deepak Sharma', 'Mangalore', 560050, 'Karnataka', 0) 7
SELECT * FROM dual;
5 rows created.
5 rows created.
p) Insert the following data into salesman table :
Salesman SalesmanNa Addres Addres City PinCo State
No me s1 s2 de
4 rows created.
q) Insert the following data into sales_order table :
6 rows created.
r) Insert the following data into sales_order_details table :
5 rows created.
4.Do as directed:
a)Change the city of Harsh to Bangalore.
rows updated.
c)Delete all the salesmen whose salaries are equal to Rs. 3500.
SQL> DELETE FROM salesman
WHERE salamt = 3500;
1 row deleted.
d)Delete all the clients who live in “Tamil Nadu”.
SQL> DELETE FROM client
1 row deleted.
Table altered.
SQL>
Table renamed.
SQL>
Table created.
SQL> select * from