DBMS Mod2
DBMS Mod2
lary Departrrant
Name Sa
Pmpid
Aten AHter
Department mail
empid Name Salany
op aa. Colen
PROP cOAUMN Email
ALTE R TABAE Employees
/Touncala
TRUNCATe ABLE Ernployees
ROP VS RUN CA TE
Oyeence blw
Thuncale
Jnop thu lablo
-eleted. he table| Gheseued
the ocUS e
Gable Cnly
nolong earote henoved
Shuclui
=89000Do
SeT Galany
UPDATE Employees
WHERE emped = |01j
102
F2bM enployees where empcd =
DELeTE
SELECT Com mand.
coum
O Mo dlitg table
tàble dd a
Gere to Books table
()Retreve the lest o all books auail able
kibnang
(8) Fund all stude nfs coho au
second gBudyng
(4) Relete the,stadet named Ahee
Snop the sBudenl tabll comp tely
Petala table Books( bo ok-id int pemary kay
title vaschar (too) nof nutl autho varcharleo)
not mull, publishd-year int, auailable- topi
cnt);
students (stud-id int prinasy keuy
Creali ta ble CHEckO
mame vancharlso) not null, age
between 18 and
tnt
tnt(age
30), cou Se varchanlso)
email vas char(coo) un ique);
ADD gerne vardhar(50).
( Alter table Books
Q.select * foom Books
whoe conse
foom students
3.Select *
ten Sci ence':
Compu ohre na =Ale.
=
foom s tudent
4. Delete
Table students;
6. Doop
Uaivesity Gustous (a"Hodule)
eiveely dißseneut steps
ottt au eaample,
1.sllusthals aneR diaqmam urto
synthesi g ng(1)
nvolved o
ulateoual gchema
E abot domau
CoMsthacnt cess
2 Ds consthacnts and
2. tohat s
Constaaent, entety eomitna ut weth
ouetablk
rejseutal teqiilg
etample (1)
tepes awailable to
h. hist the baste data
wi sAL (5)
defening att cbutes
DROP & DELETE
Dlorntali blu) ( 6)
5- ALTER & UPDATE.
INSE RT
3
Gglustnale an9
Staliment wi saL. (6)
based on t
sAL DDL stali ments
7jUHilE bchema (A sS ume
dala base
followtng
buttable domau types )
signatton, Salaay,compid)
Employee (eid , name ,de addss, twnover)
ompang (Comp-id , ernam. ,
omenttone d tables asumu
above
6)Creal the employees: Menteoi
eompany has many
éach ound mot nal
the paimany key, foreign keg
consthacnts
both tha tables. Memttou
) Srsert vaues (nto will be
onder nsesttons
lv which
Caned out
) Modity the ta ble Employee to ene lude a
ew column "yeans-o- ep
henement the salag ot employees whose
) by 5%
salary s less than Rs 25000 (8)
8. Convent the kollo awng ER diagham entoe
se lattonal schema
useaname
(Subnitdate dala
studente Scabmi
SSLan aSsigu,
mnt
empld numbes
name varchar (50)
Paimay Key
Sex varchar (2),
Startyear Numbe,
deptNo Num be
phone varchar (15
FoREIGN key (dept No)
Constraent fkpopdel
RGFERENCES DE PARTMeNT( dept+4) ON DELETE O
CREATe TABLe STUDENT
goll no Numbe Ponimary key.
name varcha
degee archar,
yea Numbe,
Sex char
dept nNo Number,
aducson
Nlumbe
address Uaschas (a0),
stud_depta foRero NkEY (daptNo)
constrant fk. oN DELETe CASCADe,
DEPARTmENI(deptld )
RereRENCES
foRe GN key (advsor
Constvacnt fk-stud ad ves07 oN PeLe 7E SEs
PROfessoR (empld)
Re FeReNces
tabe steudenl
attibute en
addess chcur(20e).
an vas
. Add address
student ADD
table
Alter tment
cs depas
te
fe
3-Rele the mame : C5
ENT
DEPARTmENS ohere
pelete from
foor
Ohat happers when gou dulele Bepasliat
S+UDENT
STvDENT ah
ahd PROFESS OR
m
vn
() he deptNo (n DEPARTmEN7 weth
ajerences deptzD
DELEiE CAS CA DE
ON