You are on page 1of 18

Nama ShVAn-R

Dta Bae manasaemori jStem Roluny 2oB0A 021Y


Wst ohos -

taLle oduck' the stose he datotls ot


17 veato a

roduck emlaor. Produes naun ,dota o marufodune


tha rodssek TrbesG attank
iCe Cnd doroipttsn akbsut
kon uy t tha talolo .

Pname dom Prila Dese

15eo Sena mDda


obil 22-oc2

reaute table Produck Pno Vasdho) 2(5),


Pnama Varrchan215) dom dato
r i a uambon 12

dobs Vas dars 2(6

YSest o Dduc Voduuo 2 Pho Pnaen

don, Prla', 'a


d dbe)
Volar Value for no', l o

Entos Volue fos Pramo., mobile

Endos Vowu for donm 22 - t - 9 2

Entarr Valu for P r i , Soruy hode)

Erdors Valueo, FD debe Sonuy modo)

Seoc fsomroduck '


209cnoD1
ShyAm R

ho name dom Pia dobc.


Plol)amopiG 29-ock-92 15oo
bo Sy medo)

P3o2 oaningy 1-mas-Do bos kg fone


machme
Ph2 Co Lonuuk 1 feb-21 6 VVd brard

Plot VeaCato 26-de 238 Pstige med

PLt -San-21 bes aUade modo

Po8 r 21-AP6D
Famritwre
tato -mas-2 o
orobrond
P8.6 evyemsto 22-5eR-2 Fbeno9aniCmodol

oytse 19-Su-2

P33 Speaucor 24-u-01 2joo amun frons


Nam product
Nul17 Type
******************
Pname AC
CHARZ
(15)
dom DATE
Pice
desc
NUMBER(12
VARCHAR2 (25)
sQL> select * from product;

de
- - - - - - - - - - - - - - - - - -

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


pl01 mobile 22-0CT-92
500 sony mode
16000 10 bKO ont odd
p104 veg cutter 28-DEC-99 238 prestige model
P COCk 21 - 1 500 tastrack mode
9 tato SAD5 Turtue
p865 Ev remote
Chps 40 panasonie model
22-SEP-21
aptOp 02 5000 hp mode
93 Speaker 24-PA- i500 S&ms ung prand

10 rows selected.
SHyAm
27 Cveate he dosvilsel bela

Tlla
NameErmplea
Emlage- Nachax2l6)

Waxchar 2(0)
STres
Vorcra 2 (3)
Vorchar 2(1)

umcer()
Stake
Wgrcha(15
Jndert Polleu docdus ndo e Jol

one State
Copoey Bllb Puilxfu chon A Dop5
pridan
boeo) Sauga ayuha PMumDai mahorwa

Coep3 Nasani S81,11lal toraalore. 18833 aralkayata


nago
Songauy bmod 315 b03 0ttarhorvd
Streex

too bb Sona DI64, Ros2 Chennen 40ol26 Tandybd


JUrdan
tOoolo OVya 61,fonard Muma 8oPIL Mehanabh
20Bce ooI
SAyAm R

Cvead bla enelageo

(Emgloy
Cptsoe Ye Norchan 2( ) ,name Vavchwr 212.0

hadmey NorchaK 2(lo) y


AJorohey Dl1o),Ymod
Vorche al8), Sala Vordnexl2l15)
(a.caar
1here nto enflnjee, olu n Playtano Nome
dhe', ti Rin adee tat )s

Ents ValueFos Bniyo-o Boo D)


tor Vala for Nome , Bcbos
Erter Vau fos ddres Bi16 tos u erde
Enbr Valuue For C dannak r

Bry Vau tor hoe 4ola5

Entor volue kos te tomlr9adu


SQL desc employee
Nul1?
ype
EMPLOYEE NO VANCHAR2 (6)
NAME VARCHAR2(20)
ADDRESS VARCHARZ50
NUMEER 0
PINCO
STATE VARCHAR2(15)
select from employee;
SQL>
EMPLOY NANE ADDRE SS PINCODE

---
EOO001 Bobby B/16,Butterfly garden chenna 400125
Inadu

E0002 aya 444,1 Mumbai 890012


Maharasn
EO003 Vas avi 58K,Tilak Nagar Bangal ore 988233
Katrnataka

EMPLOY NAME ADDRESS PINCODE


-- ****** *************
******* *******

STATE
EO004 Sanjay 89G, North streett ATmora 895623
Utterknand
D/57,Rose garden Chenna 400125
EOOO rita
ami lnadu
897,Aanand Bihar Mumbat 890012
anare

5 rows selected.
0.0BcAOO
SHyAm-

veoda the ellos oatalaae am (Eoou no Nurraor (6),


Sao Narna. Athamame Nardhnr e
Nachar(2d Dotdo
rite umbert u)
1ret the imamy key fov Hocu no

7 fose ochacle Coubaint bchoa vos/.hama

o nc DEms pata Stuctrres "))

Greotabia Bool Lboo re wamber (5) Book Mamo

VONaCos 2po) futhanma yachor 2/25) Dop dat2. \ma

uambo- 2)3
1 urtable boo murd boo
3nost t Boo Vaues oooUs na, L0oeK \ame
eutho Younnee bo,'c rma)
nduc Value toy ba o
ntut Valu er oo ame na
ha
ntor Valu fsr Ahor nome Samos lenir

Brdws Nalu tog Oap


1D-Aug -2o
Erwr Valus for t e , a6-50
2.o8cAdN
SMyam

alto alble boY add Congrrank Coc 0aama


heck bl Yam

atr taole voo ade lorusvraie

Beokname Auhorname dp
o3 Sameseor -Aug 695-6
Gato 23-may 2o 20
Dodo Studue Cn seyh
o
-maus) 5
LA

Andhrydhm3Sul 2eoo
select * from book
2
DOOKNO 500KNAME A RE PRICE
--------- -- - - - - - - -
- - -

prog 1h c james 1enin 12-AUG-20 595.>


Gavin tO AY20
3Data structures cen Josepn AR-19 *

SQL alter table book add constraint book_bookname_ck check (bookn ame in (prog in cDBMS "Data s
ructures )i
Table altered.
alter table book add constraint book-priceck check(price>-0 and pricec=5000);
SQLS
Table alter ed.
SQL> insert 1nto book values (4 prog in
'LIO 3-ul-212000 );
row created.
Commt compete
sQL insert into book values(aDS'Andrew john3-jul-212000
insert into book values (4. DBMS,Andrew john, '3-jul-212000)
ERROR at 1ine 1
unique constraint (SYSTEN. SYSCO06992) violated
DRA-00001:
sQL insert into book values ("5", 'DBMS, 'Andrew john', '3-ju1-21', '2000 ) :
row Created.

Commits ecomplefe
lect from book;
pQL
BOOKNO BOORNAME THORNAME PRICE

"n c
ames lenin 5
2 DRNE
Data Structures enJoseph 3--MAR-1 450
DEMS
p r o g 1n c
ndrewJOn
LIO
03-3UL-21
03-JUL-21
2000
2000
208ce co

EmR ene, enarma aqo Sex, un )


Depdo dramo)
Crete a table ott Nectoory foreioro 'ard Pritoy ko

A a now Celumn' Salgn ht mp table has

dtepb 4its
Change te alany Column to teps Flng mber

) Delske te Saloey Column


) Delte t Fmay ay lonstraink

vpolete the voLOs inEmnp


MDeli Be famehe table from me rploye
V1) Bel orei y Cnbiainb Pom-the table.

Grato ole Cnpene Norcehor )(6), enama. No(cha 20


umaer () dno umber(b), rea talble depk dne

TUumaer l), dnana Vaschor Olao) abas talble me modiy

no 1acor2\p) Pmany K)

obortolo depk odihy odns Mmooy (3)


Te)e
Ter emp Valu

8tno, erome, G04


e 9ew '8 dno)
0cAo21\

ers do douh
Valuio"e dnoy c dnae )
tdony Volu Por dno loo
Erttor Vadue for dname
he dearEen

EntoyValuea Por Onot bo

ttor valus. oy
neme PagaK
rtas Value Fiurge!

Pntor Valu hor


Sew femal
Enter Voue
fur olno, loo
utta hfg
)altos taoe emedd
9alary Norohay 24)5
t) atrab ewe modijy Salary fumar b,5)>
V) atuc uble me dmee umn
Salengs
v)-ater talble Bmp dme imary Key
) dolde Fvom mp twhore enno 001S
Rorname emp to
Omploe
V) o able
emplapee doporAtrask
em-ero -fr
sQL Plus: Rel ease 11. 2.0.2.0 Production on Tue Mar 23 14:27:49 2021

opyright (c) 1982, 2010, Oracle. Al1 rights res erved.


QL>
nter r-nane: Syste
nter password:
Eced.

Commit compTete.

sQL> create table Emp(eno var char2 (5),en ame varchar2 (20),age number (3),sex char (15) , dno number (3));
rable created.

sQL> create table Dept( mber (3), dname varchar2 (20))D


Table created.

sQL alter table emp modify eno var char2 (5) primary key;

Table altered.
sQL> alter table deptt modify dno number (3) primary key;
Table altered.
SQL>/
Enter value for dno: 105
Enter value for dname: sales department &dname)
new 1: insert into dept values'105, 'sales department')
L row created.

ommit Comp ete.


sQLs insert into emp values C'&eno, '&ename ,&age, sex' ,&dno);
001
Enter value ror eno :
man
Enter value for age: 23
Enten vaue or Sexae
dno
E e v a u e T Or : 100

new 1: insert into emp


al
values &eno&ename&ag
001, 'mani,23,male,100),&dno)
1 row created.

Commit comp1 ete.


sQL
Enter value for eno: 002
gavi
Enter value for age: 21
enter vaue ror sex: Temale
dno: 105
E e aue ror
alu &eno'&ename" ,&age, '&sex
new 1: insert into emp values 002,'ragavi",21, Female,105)
row reaffs1
sQL alter table enp add constraint emp_eno_fr for eign key (dno) references dept (dno);
able altered.
nto dept values &dno &dname);
Sert
Enter value for dname HR departmen
ld 1: insert into dept
dept valuesdno
values("100.
dname
"HR department ')
nsert 1nto
ew
row created.
f comniete.
SQLS alter table emp modify salary number (6,5);

Table altered.
uesC enpi

--------
4ul
- - - - - -
Type --
NOT NULL VARCHAR2
ME
ENAIE N U M R R 2 ( 2 0 )

EA CHAR(15)
SALARY
NUMBER 3
NUMBER(6,5)

SQL alter table emp drop col umn salary;


Table altered.
SQL> desc empi

Nul 17
NO NOT NULL VARCHAR2 (5).
ENAME VARCHAR2(20)
NUSE
NO NUMBER(3)
SQL alter tabie emp drop primary key;
Table altered.
QLselect Trom emp;
ENO ENAME GE E ONO
--- ------------------ --------------.
01 mant male 100
ragav female 105

sQL> delete from emp where eno001;


1row deleted.
Commit omplete
SQL select" Trom empi
ENO ENANE AGE SEX
DNO
******** ***** ** ******
DU ragav 21 female 105
QL rename emp to empoyee;
able renamed.
sQL alter table employee drop constraint epenofr;
Table alter ed.
commit
2
Commit complete.
SQL

You might also like