Assignment-II
DATABASE MANAGEMENT SYSYTEM
[UBA23302T]
DONE BY: SUNNY KUMAR
REG NO. : RA2351001030093
BBA 3rd SEMESTER SECTION:-B
SUBMITTED TO: TRIPTI AG.
C:\Users\sonuk>sqlplus
SQL*Plus: Release 21.0.0.0.0 - Production on Mon Sep 30 22:24:26 2024
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter user-name: system
Enter password:
Last Successful login time: Mon Sep 30 2024 21:15:26 +05:30
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL> create table product(
2 product_id int,
3 product_name varchar(20),
4 qty int,
5 price decimal);
Table created.
SQL> insert into product( product_id, product_name, qty, price) values (1001, 'pen red',
5000, 1.23);
1 row created.
SQL> insert into product( product_id, product_name, qty, price) values (1002, 'pen blue',
8000, 1.25);
1 row created.
SQL> insert into product( product_id, product_name, qty, price) values (1003, 'pen black',
2000, 1.25);
1 row created.
SQL> insert into product( product_id, product_name, qty, price) values (1004, 'pencil 2b',
10000, 0.48);
1 row created.
SQL> insert into product( product_id, product_name, qty, price) values (1005, 'pencil 2m',
2000, 0.48);
1 row created.
SQL> insert into product( product_id, product_name, qty, price) values (1006, 'pencil hb'. 0,
0.99);
insert into product( product_id, product_name, qty, price) values (1006, 'pencil hb'. 0, 0.99)
ERROR at line 1:
ORA-00917: missing comma
SQL> insert into product( product_id, product_name, qty, price) values (1006, 'pencil hb', 0,
0.99);
1 row created.
SQL> commit;
Commit complete.
SQL> describe product;
Name Null? Type
----------------------------------------- -------- ----------------------------
PRODUCT_ID NUMBER(38)
PRODUCT_NAME VARCHAR2(20)
QTY NUMBER(38)
PRICE NUMBER(38)
SQL> select* from product;
PRODUCT_ID PRODUCT_NAME QTY PRICE
---------- -------------------- ---------- ----------
1001 pen red 5000 1
1002 pen blue 8000 1
1003 pen black 2000 1
1004 pencil 2b 10000 0
1005 pencil 2m 2000 0
1006 pencil hb 0 1
6 rows selected.
SQL> select* from product where product_name like 'pen%';
PRODUCT_ID PRODUCT_NAME QTY PRICE
---------- -------------------- ---------- ----------
1001 pen red 5000 1
1002 pen blue 8000 1
1003 pen black 2000 1
1004 pencil 2b 10000 0
1005 pencil 2m 2000 0
1006 pencil hb 0 1
6 rows selected.
SQL> select* from product where (qty between 2000 and 8000);
PRODUCT_ID PRODUCT_NAME QTY PRICE
---------- -------------------- ---------- ----------
1001 pen red 5000 1
1002 pen blue 8000 1
1003 pen black 2000 1
1005 pencil 2m 2000 0
SQL> update product set price=0.29 where product_id=1006;
1 row updated.
SQL> update product set price=11.00 where product_name like 'pen%';
6 rows updated.
SQL> select* from product;
PRODUCT_ID PRODUCT_NAME QTY PRICE
---------- -------------------- ---------- ----------
1001 pen red 5000 11
1002 pen blue 8000 11
1003 pen black 2000 11
1004 pencil 2b 10000 11
1005 pencil 2m 2000 11
1006 pencil hb 0 11
6 rows selected.
SQL>