Date
Pag
Datatyas in SQL
CHAR Ael o-25s) xad lamgth n bigtes.
3y TEXT- eeglo-6535)
INT Iaigenl-1424EI648' 214948 3642)
eecle to 23sig')
-0D
aDATEyY-MM
DAIE1IMEYYYY-MM-DDH4:MM:L
nTIMEIAMP yyyMnODHAAMR
14y B0oLE AN 1INYINI)
4n)abaza chuza 'a
#Aocessinag Database ha B0L
USE<database omey
U
SE childee
Tables a totSQL
eatiag
CREATE TABLE tableaaey
matm1nd
ma~m1ndo
eoanlhlagee INTODINSER*
'Rany' (laog,
|VALUES_
Lnlayá TNTO mINSERT
lenaae,eedhe,
gtade sex Laelayee INTO INSERT
1000.00; MA UESC1001,'Ran VAL
melay INTOOTNSERT
VALUE&(kuady
kualey
miyscalmn
littyJ INTO KT
TNSE
#Inseig
neusFus
(Celon
aCalu landiaity
Nuiau Degee’
Rois totte
DoUBLE; ayeoss
CHAR(2) grade
cHAR( Sex
ARCHAR(so)
REY, PRIMARY INT
ealagee TARLE CREATE
Paga.
Date.
Date
Page
FROH talee-hae
OToelet lldata
ELECT EROH Ltable momme
SELECT*RON <table -nae
WHERE Lamslanditiay
SELET * FROM comployee
wtEREqade= A';
A NoT ie
b) ElET * FROH elaye
wHERE
SELE(T CRoH emaloyee
Beheeme valawesene incded
ga{=20D,
SELEeT
Toeleat pah'ulan calen
SELET alumn PROt <tale naney
Data
Page
Eliminain Reuctamt Data
SELET DISTINeT (scowmheneRA
FROM tableane
emoral dulicate a l .
DISTTNT Kuyd
ERom Qmloyee
Seleei ea all the eowsa
SELECTALL keomnhoi FROM &<ble an
ALL sala all wauess anPows ineudisg dulplicatealue
to wie th tuee dth baele
tabehome
DESe cooplangee
SELET Cundate
olumn Aliaes
matnnd9
Date
Page.
SELE CT EROMLtableramaY
'<eondilim atena
wbsteig
lwERE eanae L1RE R
SELECt
NuLL
Ro tablename
Lolumwnny
SELE CT* FRatt esmaloyae
MAERE
O NoT NULI ’alu caanat hae NULL iae
3
NTO VE’ Ensuees at alaiesiaa calumh ane
SHECk
maim1nd°
Ensus
dort
thatalialies inacalin satit
Citerça:
Date
( Page
(5 PRI MARY KEY’ Usd hunil identa
inthtblei
FoRETGN KEY ed to emuee antal tegd
the data
CREATE TARLE Custain
RPheno INI Not NULL,
Lastanae anchan ls0 NOT NULL
FietNaaeahan so
1NSERT N10 buskonnFitNamat Nae
|VAL UES ("Abhiule "Rude
Annae as Pheha isat eeided
(2) DE FAULI canstesid
AREAT E TASLE
3 , INT
VARCA AR |so)
Seope TNI DEEAULT 80):
1N SERb JNO student
VALUES (lool Ram,)
3)UNTQOE catent
CREATE TÁRL5 tudet
Mpne VARCHARSO),
INI DE EAULT go)):
matmnd
Date
(, Page
NSERI INTO stude
VALUS Roy
INTO studant
VALUEC (lool Rani 2)
al eody hient
7delete a tabla
DRORTABLE <tablehanine
1o delete o databae
DROP DATARASE ota ba
<hadabaee
0CHECK conitet
CREATE TASLE
WAReAAR
INSERT INTd
PRIMARy REY
CREATE TASLE <ta blenome
PRIHAAY KEY
(REATE TAßLE <tblena
ALTERABLE e b l e a e
ADD PRIMARY REY (columnananes))
Date
Pago
CRE ATE TABLE tudsnt
1D TNT PRIMARY REY)
VARCH ARLSO);
DRO studen
VARCHARKo
PRIMARY REY (ID):
(6)FoRELGN
CREATE 1ABLE cutaisen
LNT PRLMARY
home VARLHAR so)
RlGINT
CREAE TALLE
date DATE
Amt DOUBLE,
RR2HARy KEY (10)
fORE1 GN REy (lustomenID) REEERENES
lustarn (I) ):
!
malm1nd9
Date
ON DELETE CACADE Dalabes he teonei
osin Ahe chil table when heealucad eour
ON UR DATE CA SCADE Uhdoes thi seaeig
#3 In sezting data into anothan table
LNSERI 1NTO <tablehe to mented vawe
FRoM<tablem saa ihicksanane
(1p 1NT eRIHARy REy
manne VARC ARs0,
INSERT ZNTO studant2
VAL UEG
(1s02 "Rodu
LNSERI INIO tudent
studet 2 to stdent taele
matm1nd
Date
(n Paga
#Udrintale
UPDA E
UPDAIE todant
SET
DELEE FRoH table
table-hamney
WWERE komyConditia
DELETE FRatt etudent
UAAing Colu
|ALTER TARLE ctakleham
ALTER TASLF tude t
ADD quede CHARle)
ma~mnd
balo.
Page.
UPDATE tudemt
SET gee
Madiying column
GALE R TALE Cblehame y
TALTEg TASLE 4studet
MoIEY qedde CHAR) NOT NULL
DESC stdont
Chany eales
coles man
ALTER TABLE <tablenamnes
tCHANGE al -columh nae neurlolwmnneme
Kealumneitia
ALTER TA2E tudt
CANE qeade
ALTER TASLE tuden3
ALTER TABLE blehie
RENAHE TO <nau takle-iacnsy
ALTFR IARLE studet
RENANE TO senhedet
maännd
Data.
Pago
ALTER AoL£ <tablenonns
DROP CoLUMN eeolemnenae
ALTER TARLE meetudnt
Deopping table
DROP TABLF& I7F6xJSTII tablanamey
4ORDE R BY ALA S
sepanat selecte lity fROH talay
londiay
loRDER RY
CREATE TABLE studea
(oe IN CRIMARY KEN},
ma~mndo
Dato
Page
INSERI tudente VALUES
RAHU," A 22),
(to,RANT", ese Se)
(Lo3, VINAS""", 42)y
(lo,GARU",e,)
FRoHtuderts
*o.r5 DES
ERoMabley
<leag seanatad seleetes ity
ORPER sy EIELO
FROM tudant
ORDE R RY
DERe
maim1ndo
Dale
Pape
AaREGATÊ FUNCTIONe
RELECT AVG (LOTsTINIALL1 <teldnoesc .
FRoM tablemome
SELECT AVG (Dr(TINCT ek FROM shudent
AvAnsz FROH tudet
SELECT lennr LOTSTINCT/ALLl
e A s<lda
EROM <tablemans
ERO tudnt
SELECT liintlDITINC seletaa ARowsFRou
MAX- (eeteny mooimsls aomengaltbeJiala
malm1ndo
Dato
Page
MIN-(eatuRn minimumalwe
SELECT MIN ( lDgSTJNCT LAL
FROrA <tablename; <lielo)
SELECT MIN mankaAsMiataae
EROM hoderts,
9ELET SUMDTSTINTLALLTaaldnmey
CROM <tablename
ELECT
#GROUP 2y EUNCTTONS=
SELECT <hat to_caled
FR OM <talsleiname)
ROUP BY <heley
SELECT sectia SUMGaazk) FROM shdent
GRoUp y seetio)
maltmnd
Date
Page.
AAVTNG CLAUSE
SELE CT <what selet
EROM <tablemomeyi
HAVINa coniion)
SELSCT seecticn EROM tuden
HAVING sVHoanes n0;
sELCT paectiany SMCmane)RoM studant
Seettan
HAVING G aRETWEEN 100 AND
# GENERAL OROERR OF CoMMANDS
SELECTKealesle
FROM
mam1ndo