Professional Documents
Culture Documents
Adobe Scan 01 Sep 2023
Adobe Scan 01 Sep 2023
1) Create
CREATE TABLE Mployees t
EMP_TD TNT PRI MARY KEY,
Frst Name VARCHAL (So)s
LastNaQ VARCHA RCo)
Depastment I) TNT,
Shlesy DEcTNAL (o,2),
Depaztmerdh
FoRETGN kEY Depatmet ID) PEFELENCE
epostnentIO);
--Create te Depotmert table
CeEATE TABLE De patmend(
Depatmend IO TNT PRTNARr KEY,
Nave VAPC HAe (so),
Heod db-Depast ment VAPC HAP (oo)
Otput:
Casy ok, o row8 afected (o.lo Kec)
Quy oK, 0 rowg abfecte d lo. oSse)
uesy ok, Ovows aleched o.o4e)
Pollno:9 Set. 41
Sechon: k2lUN
the Depastmond Inl tabe
-- Ihset values indo
TNSELT I NTO DepakenenTnf (Depathned Nono, Heod. . t
MeNd. Nare)
Vaus
('He',ohn Nanages)
('Fnance', 'tane Superviso ),
('TT'; ichael Direc
hsest valus in the TobInto tble
TNSERT INTO JobTnfo (TobTite, Depastent -ID)
VALUES
('HP Manag'»),
('Accoundout, ),
(sttwase Engnse,),
(Finante Morag, )s
(Recnoite', ),
(Finarial Ava'3)
Netuk
('He.Atsihad ) ;
Name :AMBAT1 TliP KUMAP PEopy
:2||28
Roll nosa
Sechon: K21UN
5
Enaly
Darid
twi l&on
Brown
S8O00-D0
SY000-Do
Saah lee 63000- D0
Jame Andeyon 54000.00
Jenides Mortnez S6000- Ô0
lobeit Haois Su000-0o
10
Pay Davig S9000.00
6 vehieve data trem Degasthentna tabe.
Code.
SELECT *FeOM Depautmend Ino,
NhueAMßAIT DI (E EP KUMAP RE DDY
Regno :12 i|2$2b
Sechon: K2|UN K2lUN - Set!
(aoutpot
Tpattent table:
Dgpatheat 1D Depastm Nane Nead. c- Depashuad.Nane
HR
bhn Monages
Anance Jane Supervi3e
Michael Dlrect
Page s ofIs
PEPDY
Name : AMRATI DI LEEP KUMAP
Pollno :Sa
Pegno: t2|128?
Bec hon: kl0N
Set-44
We
Code Constraint to Emp_TD colunn
--Add a primasy Kay
ALTER TABLE ENPloyee In fo
ADD PPINAer KEY (EMP.TD);
-Set DepatmendTD column t not olo NO
valuey.
ALTER TABE EnployeeTnfo
No0TFy Depatuent îp TNT NOT NULLS
Dutputg
OAdding priaay ey conhaint to 'EpTb':
Utput:
Quot ok, 0 vows affected (0-0S 2)
Records : o Duplicat ;0 waings o.
(Moty 'Dep Tp' to not allow NDUCValuoy
utput:
afected (o.lo a2).
Re cords to Duplicatey : b wang
Nne ANßATI DI LE EP KOMAR DE DD Y
Re no: 2ll28D
Sechen.K21UN Sed-11
Code:
UPDATt JobInfo
Job.Tttle - 'Vce Resicdend
SET
wHEPE JobTD =S
Output
afeced,Co-66 s2c)
Guey Ok, 4 row
Rows mathed: 1changed:4 wasaings 20
(a) Code:
SEECT#
FPON Eapoyees
FULL OUTEe JOTN Depastnt ON Employees. Depasthand D
DepatmontDepatuontTD
(b code
SELECT t
FeOM Enmployees CN Enployees.Depahed. TD=
INTER JO1N Depaterd
DepetinondDepatant. TD;
Pagea o l5
Head
Le NULL
detWchod
- IT s4000-00
3
Davis May lo
3
aras Ton 64000-00 Hasw? Robet 4
erngc Taue Finonce 56000-002 Natirez Jennie;
2
ecte Hehad 37000-0o
3 Ardezor
3 Tames
HP
62000-00 le Soiah 6
1 Broaon Daid s
4o Tane fnonce SUD00-00
2
2
chd Hichocl 3St000-
00 3 son wil Enuly 4S
IT
62000-00
4 Mchae|Tohnson 3
esuiso Fironte
Soa Suth Tane 9
60000.00
1 Doe John
pashant DepshtMe-TD Na
tait topFivgtN
FUoutput:
l
Set-1? UN
Sechen:
Kz(
DEDDY UNAR D2LEED ANßATI
Noe:
DDy
Vae: AARAT3 O/IEP KUMAR PE
Dollno: s9
SecHon:K2lUN
Cuieut
Eup FistName Lat Depat Nao Head of- Dopod
Nuea) Salay end 1p
Ooe oO00.00
3 MichaTohngon A 62000.00 1
Tohn
Mangcs
|6 Saoh lee 63000.00
Tane Suith Skooo.00 inonte Taae Supeikch
S David Brouon2 2 Fincnce Tane SuperviB0)
T6 D60-0O 2 Fhance Tae Superise
Mickael Divech
thuly uilBon3 58O00e-003
Euily IT ic ha Dive cto
Ardeten S0o.00o
Nay Dais 3 TT Nichael Divecto.
S4OD6. 003
Ne: AMßATT DI LE EP KUNAD pEDDLY
Reo: 12I|287D
Sechon: k21UN
Rollno sa Seti
FRON ploges ;
Ouput:
Expbyee I D hrst Nae Last Noane Sloy
Tohn Doe
Jane Sitth 62 000- Oo
ichaet Johnon 48000- 0o
S6O00 00
Exily
Daid
wil&on
Brown
Sasah Lee S3000- DO
Tames Andes on S000. D0
8 Jernites Maihnez sS000. bo
Robest Haig 64000.00
Darns S9000 O0e
May
Petnese names o eupleyay with
wrth S,0o0 om eau table:
Coale.
SELECT first-Nae, lat Name
FeOM
ltERE Saliy s0000;
Page
kONAP PEDPy
Nce: AMAI DrllAD
Veg no |211252r
Secion: KeluN
Pellnss
ootput
fust Nant last. Nosaal
John Doe
Jane Saith
wilson
David Brown
James Andotion
Robet
Davis
Naty
ootputpot:
() Tobs table:
Co de:
SELECT DTSTTNCS Job1ttle
From Jobe.
10b8
Page n s
Pecien: KotUN
Poll no:s4
otput
Calesçovson
IT apeciali.
Code
9E (ECT UPER (first. No) 4s Uppeaoy FivdNouo, UPPERllod. NandAs
UppevrooLat Nao.
fvorn ereogs,
Code
John
Uyprcoe lat Nao.
Doe
Jon Snith
Micha Johrgon
ilgor
Dond
Nostne
Qollno, s9
Rohieve
Cocdo
SELECT Tist Nano, \at Nao
FRON Eployees
O4EDE oeateat 'Saley'
botput:
Fist Noe at Nae
John Suith
Doe
wikon
Lee
outpt:
Dyashunt Nlunbes ot-Enplosees
Sales
Maskeng
inane 2
2
Name; AMßATI DT (EEP KUMp PE DOM
Veho: l2128
Sechon: K2lUN
Rol no:sa Set.4)
Petieve naes dot emplooes who lagt nome tate aith
and job itle is aot Manags
Coe:
SELECT Fst-Nane, Lat Name
FRON Enloyee,
wHERE La-Nae LIkE '3y2 aND JobTitle 3 Manag9
Dutput: