0% found this document useful (0 votes)
57 views

SQL Notes

SQL is a structured query language used to manage data stored in relational database management systems (RDBMS). It allows users to define, manipulate, and control the data within an RDBMS through SQL commands to query, insert, update, and delete data as well as create or modify database structures. SQL standards help ensure compatibility between database systems. MySql is an open-source relational database developed and supported by Oracle Corporation. It supports transactions, stored procedures, views, triggers, and other SQL elements.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

SQL Notes

SQL is a structured query language used to manage data stored in relational database management systems (RDBMS). It allows users to define, manipulate, and control the data within an RDBMS through SQL commands to query, insert, update, and delete data as well as create or modify database structures. SQL standards help ensure compatibility between database systems. MySql is an open-source relational database developed and supported by Oracle Corporation. It supports transactions, stored procedures, views, triggers, and other SQL elements.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

S8LSah is a daubos.

Coropuk anguccee
alCAigne.c ler the efvaloncl maragemen
Telauiona dal abase
dakaa

CGLshudud 4Mo honguage


SaL -Y h Stcuncdared hcquo
Sclainal databaae movogement em CeLBm
Oe
mySay ,_mS atte a d a SQ LSe YUri
l6
Standard datakose Ltugueges

Applicaiobi
data h he rulabon dbms.
CAllos to actes
l o ws s s to dascot be oe daka.
Cear4 drop_database
and
Allows ACs h
tbles
t l d s Users b Ca c viej gered proteolulTe
hunchioos

ho is SL
kawgungt, hich
SAL isa Shuctucd auery
empuixkanguo Stming manupulah
tsa
4Yehtseisg data stmed in RDB

SSL achitecture
SAL 9uey
P a r s estophme
Quory long_procoAo

bBMS engine
Filemona9e
Treunsachon rdonaar

pysical
olataba
ghancas
SAL Commands:
S b c shandard SBL Coromounds to rexad i h

Telab ond
dostohaues aNe Creae ela nsex .
pdot. dli nd dropTht com ands tan be
clasittofio-ae l l o a roups boucd
on.

DDL Dabo Dentton languoqe


Crea-_ceaa
Creali a neo realole, o vies e a teble, croth
ojec he deatuose
2ALTER modeTes an eu ng_databose sbject
Suh aA a talble

D70p Delsi an epte auble, o vie o) a Fable

Otbex okferk n the lataubcue

OML a Manipulahicn nguage

L.Sele Refeve Cexa record hrom


mOte ables.

2- Tnser:.Create aYe Coed.

3 pcoti : muclfes recorcls..

Al Delute : Deli reocs.

bCL - Doua Con rol anguag

rant:6iyes a pyPvflage +0 Usen

Revoke:Takes back pvfvilages gYanta


isRDEmsstoncls.oelaional
K h a t i ' s R O B M S

Relabona
M a r a g e m t o y s k e m B D 8 M s

alkhockm
cdakakase_St

rale
sysems ltk
aned ha BMIDB2,.brale
S A L T S e x v e r s E N I
DB. My sa1
MS
|andmicanseE_acteSS

A vehhaoatabose noanggemep
the
m a n a g e m e n F y s E R m

is
a dababose
relchenal
m0olel o u fohocuted
oocd on he
E.Locld.
oppliee_on anydalaba
Can be
hese ruls olata using0nl..
managA Stmed
Aystembat
opabtHA his is a lnrlah
elabbnal
uleohich acz asa
bcbe her cul tbe'othe
Tults
Ruli Inlmmahoo uli

Rule 2 Huaxanteedule

Sys tumahc Trecume ntoi_null values


Rule 3.
Rule 4Achve onlihe Coalbg
5:Comchensive Data Sub kanguagevulu
Rulk
Rulea yiw ipctaa ng mule
2upclodi cuno oleleth
Rula T High-level insert
Yil
|Rul : physical olata hdepenelente
Rule Ligfcal data holepunolnce
Rulel0 Inteqi indtpendente
Rule n Disbibuho nolependen
Rule 12 non Sub vesien ule
ghandas
Ihar is edsle

The cala anknBs s


obje cér hichage storein_dolabnte
Colled os tibles

haiseld
Evey lable s b>oken up fn tt Smallen en HHes
dallac ields

Aohat is c Record er a Ros?


A ecerd s also calocsa Ro oclata is each
nd idual enry ba ess ina table.
ohat is aCouumn
A Colump isa VerH cal enict a table thaE
Conains al hkrmahen as.ociatrd iha specic
keld ha ttuble

hot isa ull vae?


A alULLvalu h a table isa alluu ha teld Hot
Qppeaxs to br blank ohich means a jield ottha
NuLL valus ls.a jeld _ofh noyalue.

SSL Conshrants
daka ceum
Cons rafni ae the les enjeced on
lfont the ypeo
o Da bable: Tbese are Used to
Tha_eAuTek
daba that can g no a:table.. data
accuracy and eliabi Ey ok
the
h
th lalolosi.

levele7 teuble
eftherbe columo
Consihaink iCan h.ome
are appltel only
level conshadk
leve cokumg consbreutns ai applite
Columnwbere os table level
bo the eafre truble.
ANO TAOLI oshofs Ensuncs tha: a (cunr
CADno hove o NoL aluu
Delaul Censhaols: pvovides a dolault val
bor a Column ben rane s Apecilied.

inu ConshonteosurA tha cu0 he


Vlus acolumn aNedilerent

PNoakey uniquuy idn bjies each


YecoYd ha databose Fouble.

Ftiqn Key Lniqeonhhis von e


CunyCumotiex olatibase talóle
chec nshafnkr Tbe check Conshrofn
ensuneA thet all valus b a calumn Galis
Caxtam Conei hionu

Lnclesc ed o Cneatr and rehYeve doba


om the akabake vei aick
Dato mktani

be ollang Ccuagits ocloda infegvth aiut


th tach RoBM`
Ent trai TheyA ae no puplhcoi
Yos a tdble.
Doma httay enlertes valiol vaDn
yen (olumn by esridting the
TYP Hhe m t .oxthe rOngenO Vales.
on
ahich oe sed c1 bez e CY
e e r d a i ned
busfneS rulus a do oot Jall n ei dorra

DoaDrma.zabo
Daka kose Dexaiizabibn sprce c it
osqarisng data fn daakase 1erere t e
edses q Hhs netmaliaoise prous

clminatig edundant data t2ompla r


fhSome dala mce han me

nsurna data depedunciek make Serse

NP
2NFF

3Td NF.
BCNF

4 b N F ekc.

My S L database,whicb -
ADuR ASL
MysaL is an bpen compansNYsyL
Atdish
is avelopec bythe asmy
es-qut-el
ispronDunltd Se
"S eq
qeel.
MySaL Pronounted
AB witaSSL
ras t
i n Con
dherent plaHn
jerent plaHn
SupporHing
many
MYS&L s nels t h e mojo
mirosoLF la
a Cc oSx.
oSX
1ncluctha
uMP cund
bukoi
disbi
Anw
MySsL has ree avc poaiol versids clopendine
Comes ,
on its scLqe cnd ecdesMYSA
-hrcoded,mulh-Llser ancd
very Jas mulk
YobLut SSL daabase Servex

Histey
Development o My.squL by mi chao Wídeniu
4DavidAxmonk begioning 9h
on 3Tel mou 995.
|Fhst intenalreleasC

Windowg VeysTo0. 3 OS releaked On the st


Jinuar 998 jos windon 5odNT

JUne 20D0,
VOTsfon3.83 beta from
orodluchen velase Jounuary 2001.

Version 4.0: beta_hrom August 2.00, Ptolucho


Tleasemarch 200 5(unfons).

Nersion4 beka pomm June 20oHpvoduckon


elecaeockobe D0oy

poduchbn
Versfo 5.0: beta om march2005
ydease bchober 9oo5

Sun micnokystem amuärra0psa ABh


e 9thebruamyi

produth a releoase1T*
Venbi 51:
OOvem bes 2008
ghancdras
Fealuo
iohper e.manta.
avat abtlfty
Scolcubiyad
Scolabilt
2obusE
Hexrbilrhy Ran aMAthRq
Tansach onad Suppor
weband dato Vore hous she n
s hong darc pretethon.
ceme hensiVe applicobon de ve logrroo
mwno eden Eose.
epenS Ce Feedem and 24*TSuppo
Looest ttal Cos oh OHoexsbfp
S&L Data ypes.
ss L dataype s cun atri buth hak Apeku
te pe O lata oj any obfec Foch tolumo.
yanialleand Uqmessfoo h ovs a relauted data yee

xac Dumeic data ypes


Datatype 10To
bigin 7,223,312,0361SSA11SsO 9, 223,.
int
-

2114 T, 4s3,6 4% 214 1h&


Soallint 3 1 GS 32,T6
Hyint
6
.1o3S-1
diimel
DUmexic on 3 8t 1038
-122331, 203 ,6 es 17 SgO8 9 2 ?3ST-
money4 +2ld, T 48 36T-
SmollnMoDe 21H1H336H8
a r l Thme daha TyP8
dahh me
Small doti ne
cdatr
fme

Approaimatt nume c dha typer

d a a tYpes
Charackn shgs
Chaa
Varchas

VarchaxCmae)
tex

chamacir Shfngs olaa lypeu


Inicoe
nchax
nyarchar
OVarchartmo)

nhu
Bhamy dbta types
1bhory
2Varbihary
3 Yevrbhar ase)
Hdma
|Misc datti ype
CuSOY
Sl-yantantt
Gable
2- meStamp-
iniGke duwi ien
char das
S8Upezelev
A theoah Cpenoit
CempcAS On9peio
Legica pexalei
rOpenots used y neaett corditrcrk.

S SL A thmchc Operotri
+Coditon)

-Csubshacion).
Cmulb pliccuhon)
/(ofvision)

mccdulus).

saLComr'Son 0pexaLens i

-(noEcqal)
Hheyabue s Hoo openunos ane equalrnod
4 checks i
reoti than
l e s s than
v
7:_aciir han oreqnad

less thum y eaal tp


4
%Doless than
t grealer.thaun

S l o g t c a iopercts

8. loT
ALL

2:Ard l 0 SNULL

3.Any
H.Beween

f . Like
S8 etpressior.
Tae ane- dilentn: lypes byS8L prexsitra
1ohth anne menhonbeloro
Boblean
Alumerf
*-Date
.

Booleanepeisiam
SSLBoolecn eNestonelch:the clata
bexbed onmatchfng a sengle Valise
Folloihgis the Syntan

Selack column1 Column2 Columa


FYom table--:ocume
hexe Sngle \ale motchig epAitni

Consiour the ustomers: table harg the llowing


ecoadls:

SsL>SELECT *PROM CUSTOMERS

NAmE EE Sed nDRESS.


TO
Ramesb 3,200 amidaka
thilan 2S Delbi
2
3 Kauahik 23 200 .koto
2 S 6 &SDD mumbai
Choitali 7
HOndi k sSoo hopa
uOD MP:
komou
10,000 Inolore

tcomple
heolbwing toble isa siple Boolear
usoge oyarins SaL
Shewig the
chor
Akme AE ADngt
Scd
ere Solorq1o000,
nclore AddNes.s
almaai Peso4
hesc

humah co Opur
math
folong ti olon n
o
Spntust
elkc numeni cal-
CFYo CubleDame
epressicm a
Optrabion-nom
ohere Cenci tioJ;

Doxtr UpreSiom
Dati eptSim tlunCuhunt ssEem
Kme volues-
dalr amol
S8L Seleck CUrent me sttum p:
Cument-TimesFamp
20 09-tt-12 HOs 23.
arpwn. sek CO-0o Sed

You might also like