THADOMAL SHAHANI
THADOMAL SHAHANI
TSEG
ENGINEERING COLLEGE
Expeuin unt 1
Tdumhhy the Case shody amd
detadstatenent
problem
Deaign Entiy Relationship (EK)
Extnded- Entithy Relatimahinp (EER) model
Duaigning
the heme
datobaue that
the
Stous
socity
the data o all
along with thei
details Wke NaneL Phone Numbe Nom'imee, AddLs
and cntact detais heme ne
given
Resident Jhe maintnane pad by
the sidents Jhe amountpaid and
the amount to be paid is kept tacking. s4 the.
nmbeu day the
outstanding last etends
40day
Status.
thun the sident
gitn datastee
Jhe total ament paid by the xsidemt
maintenamce the
the soiehy Al the
made by the sociehy to canins partia
lihe
Rupaiing anchiteche Muniamdcipal Watx Tax
packing changu a
the ameunt
caleslattd. Jhi dlatabae providu way
to the administuatos of the society to
and fetesaly menite thein eocrpemaeA amd
Hiieaty
EG
Name Contact
Dtails
MembeuID Residents (Adduss
Flat (ing No-)
Sining
Fund
Repaik
Fund
No
(Packing
Poys
Total Amount Churqes
Paid
Dve Dat
Mauntenama
Stots
Defawtt
Bill No , Stats
Month Year
Sinking
Fond
Gudied
To
SoCIETY INCOME
Repaie
Fund
Bolanee Pauking
\haugs
KDebiko
{Amount
Expene
bxpene TO Nabre of
bxpeme
THADOMAL SHAHANI
TSEC
ENGINEERING COLLEGE
Exp eximent 2
Reletiomal shena
Ain Mapping ER EER
model
Residents
Mombu-TO Flat No Wing No
Residunts-Name
Membe- LD Name
Reidents Contact Details
MembexTO Phone- No
Mantemamu
Poid Dve Oocte Bill-No MemID
M Sinking Fund
Rugaia Chang
Ping
Souety Income
Month Year Balane Panking Repain
Fnd
Sinking
Ffnd
Chaxgs
Expunses
Month Year Amount
Natoe ot ExpenseMonth
Cxpemse -ID
THADOMAL SHAHANI
TSEC
ENGINEERING COLLEGE
Experioerat 3
and
Ann: Guat database
usimg Data Delinitin Langunge
Cons taaumts
apply appropriat Tatguity
which
stcmds Data Deljnitin Lamguage
SQL used e djiming and managn
Commamds a
databases stuctus and schea.
Used te CHeate modily and dalte database objecs
tales ndeas views andconstrants
such
Some the DDL ommands ate
CREATE Jhis Used to wude databcwe
yiws constaints
objzch Such tables ndeoas
tablename
Syntaz ' CREATE TABLE
datatype conutaints
comn 2 datatype constxaunts
2: ALTER Jhis conmamd Used to modiyy the
and caiting databae obizt
ALTER TABLE tablename
Syntan' Lonsointsi
ADp camnn arne datanype
3. OROP usedd to daute am eaitng database
objact euch table, 'ndec
tobe-amei
Syataxi DROP TABLE
THADOMAL SHAHANI
TSEC
ENGINEERING COLLEGE
Lategity conitacink
constrants oles that
Sntgity the acana and
database
data withiio
the database folloussprudabinad
consitenynwle, pruenting
invalid im cons iatemt data
Types of intugity
constaiok
constaiat i that each
Painoy Kuy
mend table centited
uniqaly
that Vas sprcikied be niqat and
not
CREATE TABLE Studemtsl
STU DENT LQ INT PRIMARY KEY
Nane VMRCHAR |50)
constaint establishes a latinhiyo
2:
Fouign Ky
bebuten two tables by ngaing ekramtial integuity
t. yalres cdmn
matches
onothn tabl's paimany kay
CREATE TABLE
Onda D PRIMARY eEY
OudeDat OATEL
FOREISN KEY (lus tomen Io Refenenes wstomees
3: Not lcmstrainti that
Cannot contai Yaues
table mst haue for speitied coenn,
CREA tE TABLE Custans
CUS TOMER IO INT PRIMARY kEY
NAME VARCHAR (5o) NOTNDLL):
THADOMAL SHAHANI
TSEC
ENGINEERING COLLEGE
Expenimernt
Airni Populate database
th
usinng DML
speikied ystema
OML Data Mamipolation Languag) commands
used to intenat with deta stoud in the
databue Jhy ae spngible
-updating and deleting datu withirn
tablus
OML Con mamds ae
fallows
4SELE CT Jhis connamd wsed to tiere dota
tablus the database
Syntazi SELECT cen1 colmn 2..
ERoM talename
HERE condition:
2:NSER T Jhii command used add
imto table
Syataz i INSERT LNTO tasuname coennlnn2)
VALUESC valel vaue 2... );
Jhis cornmamd
3. VpDATE Used to
modiby szisting
table
Syata i VPOATE tabuname
SET caimnl Valt 1 cemn2 = vaue 2
wHERE Canditia
4pELErE - Jhia camnand used to neee
tabe
oELETE table-name
Synta wHERE Conlitin:
THADOMAL SHAHANI
TSEC
ENGINEERING COLLEGE
Expoimernt
Lelom simple qpexis stunng mamip olatim
optxation amd agugate functims
. Slet ALCmns
SELECT FROM tablename
2. Sede t speahi Cetum
Cotimn2 EROM tablename i
SELECT
3:Selet with WHERE
talbu name wHERE condition
SELECI
LKE o padtexm matohng
SELECT table-name wHER£
Camn. name patkun'
5: Osnq oR
Selut FROM tablename wERE conditionai oR
CONRTON 2
6:Vsing
Selet
DSTNCT
DISTINCT Codamn-nam e FROM tabenAame
7: oRDEK BY .
SELECT FROM tablename oRDER BY Cnnnane )
FRO M tabu d
ONLON
THADOMAL SHAHANI
TSEC
ENGINEERING COLLEGE
SELECI CAmnname FROMtable 2 i
q INTERSECIION:
Selet otmnnam Fom tabu 1
whene tSELECI
eis codmAame FROM tade 2
Whene talu coumoneme = tabde 1 ctmname
10: Excepti
SELECT cemnname FROM tabu
-£xcepT
SELECT comnname FROM tabe2i
Function
Min SeLECT MIN (cad-nam) EROM tablenane;
i)Ma - SELELT MAX(cot-namne) FROM tablename
SELRCT AV¢ Ccot. nane) FROM tablename
i) SUM - SELECT SUM ename) FROM table namne
v) Cont - SELECTLcoUNT FROM tablename
SELECr oname coUNT() FeoM tablu-name
GROUP BY colname
HAVINa clause
SELECT coname CouNT[ *) FROM tablenam e
aROU BY cmamne
coUNTC) >5;
THADOMAL SHAHANI
TSEC
ENGINEERING COLLEGE
Expiment 7
Jo innplemumt al Join opxatima
). NNER
SELECL tablel. wl-nametable2. cole namne
EROM
INNER JOLN table tabe lattd col = table 2 l-cali
2. LFT 0UTEK
SELECT tablu cennname tablu 2 snnn-name
EROM tabu
LEETTOIN table2 tabud. ul-col= tabl 2- relcoli
Z: RIçHT TOLN
SELECI tablel: olname tabe2: cole name
FROM tabled
RIGCHT JOLN table2 n table related ol = table2nelated celn
4. FuLL QuTER JoIN
SELECT table4co name table 2. colname
FROM toble
FOLL ourER ToIN table2 oN tabled xlatd col table2:l-cal i
5 NATURAL JoLN:
SELEC FK OM table NATORAL ToLN table 2
6. CRoSS JoIN
Select FROM table1. CROSS TOLN table 2)
THADOMAL SHAHANI
TSEC
ENGINEERING COLLEGE
TOIN
Selct A. col-name AS AS A2
EROM table- name A,tabenamme B
WHERE A: dcol 6elcol AND Apuin axy hey
6puinaxy ky
8 NON
Select tabe . col name tabe2. colame
EROM table 1
JoIN table 2 ON table . rel. col < table2 l col