Idassignment 3
Idassignment 3
salary cnd ne t
) Display name,d past ment, q 30ss 20°/o HRA
with 10S/o DA,
SaUlary Ok i nst uc toss +DA + HRA.
-Cgvose salany = salay -IT)
net salary=gross salary
+ROM lostrUcto
L7KElo:
WHERS Nme
ol
NOne
Dept Name Salang
Sci.
Ssinî vOsan Conp T200O
Csick B iolog
6766 qz0OO.
8382l Bsad t
Comp Sci.
Katz
S ini VOsan
with a
(g) Update all secovde s Instruc to table
sal ny hi ue o6 Iso.
UPDATE lostrvc to s
SET Salory = Salaryt 0-15* alay
row0S updeted.
ot 3 o os
) Update the secoxdc wit a saloy hike
Comp. Sei. Dept. instruc toss fhowing colay Les thas 7CoO0.
UPDATE Ins tructos
SeT
Salay Salary t003 * Salory
WHERE <700 oo AND Dept_Nome = Comp. Sci
up dated.
Corp-Sci. Dept_Name.
Solay Colwmn Upcated bor
in ctructos.
) Dispay the annval salay ob each
Solary*la
SELECT Name,
FROM Instructos
selected.
Olp 2
having t:tle Ghome Desig
the title ot the couTSe
)Update
to Game Theosy'.
UPDA TE Couse
Title = Gane Theosy
WHERE Title = Deaign'
lp: 1 row updated.
Histosy depantmet
k) Delete the instruc tos
FROM coURSE
DELE TE
WHERE CourSe- id
LiKE BIO lo
Olp: 3 rows delet ed.
2) Weite the s9L Expzessions fox the folousing querieg Using
suitosle SOL aagse qate function.
o6 instruetos os Physies dept.
) Display the Avg-solog
AVG (SolayAVG. sALARY"
SELECT
FROM (nstructo
WHERE Dept- name Physics:
olp AVG. s ALA RY
1046SO Paid to
b) Display the Dept-name
cund Average saloy
depatett
instructos oh each
SELECT Dept-nae ovg (Salany)
Instrvctos
FROM
Gsoup by bept Nome;
select ed.
Olp Grows
Instructor
Depatment of the
c) Display the l, Nane &
the bighest s a l y
drawing
Dept-Name
5ELECT TD, Non e
Instructos FROM
FROM
CSE LECT
MAX CSalary
WHER Salay >
lostructoo
Dept Name
Nome
E instein Physics
2 2.222
availabh in Comp Sci. Dert!
instauctore
the no. dk
d)Display
lnstrctoss
SELECT COUNT *) AS Num
F ROM lnstructos
Sci. '
WHE RE Dept - Nane Comp
Num lnstrutoss
Comp- Sei.
wise gt values.
totall budqt
h) Dispay bu:lding
SELECT Boildung, SOM CB vdget ) AS Total- Bydgt
FROM Department
GROUP
ey Boilding :
To tal-Budqet
Boildin
140o00
Paint
1600 0o
Watson
Taylos 200O0
Packad
departments.
os c ob each
of inctruct
i) Disploy h no
coUNT C*) AS
Numnstrutoss
s ELECT Dept-Name,
FROM lostructos
GROUP BY Dept-Nne
tos s De SC -
Num_lastuc
ORDER BY
instuc to5 s
NuM
pEPT.Nane
Phy sics 2
Comp- Sei.
u) Display the no
coUNT ( ) As
SELE CT Senegt ,
FROM Couse
GROUp BY seme te
SELECT Dept-nane
FROM Instructo
coUnNTC*) K 2
GROUP BY Dept -nane Having
Olp Dept -Nome
ELec. E ng
Biology
Comp. Sci.
Music.
Noslostvetog
Dept Name
2
Co mp- Sci.
2
Physics
m) Dirplay the be pt -name that hcs e d to tal
salony mose tha S ooO
SELECT
Dept nnme
FROM lns truc tos
GRO UP By Dept -name
touing
Dept ~Name
sUMCSal ary > soo O0
Phy sics
Corp- Sci
Elec - ng rows selected
o) Display the total budget fos the bulding built
by watson
seLeCT SUMCBudget As TotaBudget
PROM Department
Buildinalwtcon'; Olp To tal Budget
1600 o
P) Display highe t salary ob the nstructos ot
the
Comp: Sci. pep antmet.
SELEC T MAXCSalay) AS HighutSalany
FROM Vnstrcto
Dept Naye
'Comp -ci.
WHER¬
Olp? HIGAEST_SALA RY
|oS 8 O0.
whee
chinmayi1)
CUPPER CSOBsTR C'
SELECT CoNCAT
'chinmaui, ) ) )AS Name
LoER CsUBSTR C
wit Capita- Fisst - Lettez
fROM DUAL Fisst - Letter
Nome- wih Capital
Chinmcuyi.otees
fROM lnstcòs
olp
Soiniasn
Chold
rowS
celec tad.
each instruc tox s
e)Lis t the depatmen t name ob
3 lette code.
Departmet Coce
DeptName 1 3) As
LCT SUBsTRC
FROM IastrucEos
Department Code
o/p
Fin
Mus
selected
o b eachzostuctos
CDate-ob- Jo înig
SELE CT Name, DA TE FORMAT
SAS Joinin¡ Date
FRoM lstructos
Olp: Osows s elected
Display the ex peuen ce o7 each nstruc tos in t e n
ob months
SELEcT
NameTIME S TA MP DiF CMoNTH, Date_ot
oining CUR DATEC) ) AS Experience -Mon the
feOM Instruc tos
p- 10 s elected.
(i) Display the expeence tn tem ol yeone &nmonths.
SELEC T Nane,
FLOOR CMONTHS_BeTJEEN (SySDATe, Teining_Dade)y
2)||yeans|
MOD C MONTHS ETOEENCsySDTE oining-Date)
12)| months AS Exp erien ce
FRO Instuctos
Olp- |0 sOws selec ted
2724& ) As
Ca4204-
TRUNC
Se LEC T
FRom puAL
Truneted- VALVE
542
exps easion
the value
ob the
AS regultrRoM DUAL,
) Pisplay
Olp? resolt:
1 3 4 2 | 4 4 3 3
G4643)2
Find ÖUt the
S9t
Squau-Root
ROM DOAL
n) G4312) AS
SQRT C64
SELEC T
S 9 u a e - Root
olp:
2 5 4 2 . S o l I 3
IIERn
lowen cae
HELLO
FROM DUAL
Lo we
Olp?
hello :te