You are on page 1of 9

DATE

PAGE NO

u plaun tu fallewing uunctin e MySq tuit


examplu
A Su mctinns
u3 AsCII The AScITO unctimm heturn thAsC
valu for the specifio chamacken
Synkax:AsCII Cchanacken)
ExRelun the AscIT valu o thu fnst Characken
in "CuutemnName

SELECT AsCII CCutmenName) As


NumCode 0fFinstcha
FRoM Custmen4
RTRIM h e RIRIMO Lumctiom henmtve Draitig shaces
om a dhiug.
Snfax RTRIM(Shing)
Rem.ove traitingpdces rtm a ttiny
SFLECT RIRIM C" SQL Tutorial Äs
RightTnimmestrin
C33 TRIM: TheJRIMC)umctionhemvesleading amd traili
Spac rmtMg
Szntax TRIMCShri)
Ex Remave leadimg Omd naitiuns dpac fmaktrzings
SELECT TRIM C sQL Tuforial) As
Timmed Sheiag j
Taachar's Sign atur
DATE
PAGE NO

4 LOWERU he LOwERO unction Convetéta string


o LeuLn Case
-

mtax: LOWER Lkext)


Ex Comvenl the text to loueCase
SELECT LOuER C SQL Tkorial isFUNI

t5UPPER he UPPERUunctim Convets_a dtig


te UppeCale
Syntax UPPER CAext)
ExComvet th text fs ubber- Cale:
SELECT UPPER CSQL Tutrial à FUNI");
CGREPLACE he REPLACE()Umetim neplaces all
OCCwhences oaAubatriuag usithiy_aibrinsg,
Lith a new Subatniug.
Stoax REPLACECStingpmshing, neu-Shi)
Replace sqL with"HTML':
SELECTREPLACE SQL Tdoria sqL' "HML');
CHLEFT: he LEFTLunctim extra cla numben e
Chanacke rom a kbuing(tadtiy rtmeht).-
Synto LEFT CString,mumben"ohf_chaa)
x a c t 3 chatad lens ma dtriuy Cstatim
tnet):
SELECT LFT C"SQL Tuarial",3) As
Extrat Shingi
TeccherS SighellE,
DArE
PAGE NO.:

C81 RIGHT The


RIGHTC)uctim
oclhanacters extract a ummber
tm sbring CStatin ptm
a
night)
Syntax RIGHT(Sbiny,
Extract 4 number- e- Clharu)
Chatna cfens prm a stung
AtVJ
SELECT RIGHT CsQL Tuutorial ia Cel, 4
As Exract Shinga

GCONTACT The CONTACTU unctim adds


tus mre
expseuiem kagethen.
Spnkax: CONTA CcT(exphesim1,
xAdd sevenal brinzkegelherxpnession2, expeujom3,
SELECT CONTACT C"SQL,Tutarial isfun!")
AS Cancatemated String
Ci3
CeSU8STRING he SUBSTRINGU) unctim
extract
Sublhriy m a 8iiny CAtactig af anya
Syntax:SUBS TRING CStin45tad, leugth) aesitoy
EEtacd a
Aublthuy fram a
dring Catast af peichin
5, BDA extrac
charaltensJ:
3

SELECT SUBSTRINGS QL Tukorial5,


3)
As Etract Shrig
1 REVERSE he REVERSE ) unctim hevtsu a Abiiss
amd heltutnt the hetult.
Sppka Revente- REVERSE CStriug)
Tascher's Sign ature
DATE:
PAGE MO,:

Reverke a Atig..
SELECT REVERSE CSQL Tukial");
Ci3
REPEAT he REPEATOunctin hepeah a string a s
many tinns a Ahecificd
Spstax: REPE AT (Strins umben)
Ex Repeat a stuu 3 times
SELECT REPEATY SQL Tubrid, 3)
3 F1ND-TN_ SET:he FIND-IN-SETO Gundtien
hetwn the beitin a dting
within a liat of Atnings
Syptax FIND TN SET( Stuim stiug -List)
Ex: Seoaclh her q uithin khe Lut of bing
SELECT EIND-IN-SEI( S,,

U 41 GREATEST he GREATESTOumction hetutns the


freateat value of the list o ajuemeuds..
Syntax GREATESTCarg,ag2,g3,
Ex Retum the greatest veluë of te list
List Sagunmeuti:
SELECT GREATEST C3, 12, 3,8, 25);

153 LENGTH he LENGTHO unction hutiim the leugth


o a Ating Cin by tka)
Sytay: LENGTHCSti)
EX Retwm the lenth ef tta tbij i bzks:
SELECT LENCTH C6QL Tutorlal") As
Lenyth.ag Strin Teachers Signature..
DATE
PAGENO.

16 LOCATE The LocATEUumctiom hetuns the peiity


ef the inst occuhemce e a 4uhshiugina
Atring
Synta LOCATELSubibiugAU)Atat)
B Seaucl for"3 M Atniug dasaPoddas Inkon natimal
Colleg" And heun perution
SELECT LOCATE C"3"3Poddan Iukomatinal colUge)
AS Match Pesitiom

Numben Funtieng
CL SUM The SUMOumctien Calculates the sum ea
set e velues.
Syntax:SuMexhteulm)
BRelwon the3um efkhe QuantityulA in the
he
Onden btaill Jeble:
SELECT SuMcQuantity) As
To-tal Ttems ulered FRoM Onden Detail1;
AVG h e AvGUumctim heturms th
Qvenage Value
Stax AVG Cexpsueim)
Ex- Retyhe averase value or {he Puice Colummn i
he Phoducts table:
SELECT AVGCPAice) As Aveg qe Prrice FROM
Preduct

Teachar's Signatura..
fG..rresenantrnd
DATE

PaGE NC,:

C3.1 MAX he MAXO mctim hetum!thu maximumValue

in a ket o Valutk:
Syntax: MAX Cexhneuin)
E ind the bice ef the metf exheniiephoducd i
the "Pmoducts" lakle:
As Lazet Brice FRoM
SELECT MAx CPnice)
Produch,
metim netims h e minimumn
C MIN he MINO
Valu M a det of Values
Syntax MIN(exteluien)
tu
Ex Find the puice of thecheapest rreduckiu
Poduct lable:
SELECT MINCPrite) As SmalleAt Pauce FROM
Pueduct 3
T53C0UNT he COUNTU unction hetuwnms the mumber
e hecords hetumed by a deleCt 94uehy
Sxntax : COUMI (ExhHesLLon)
E:Return the number o produch in the Produsts4
table:
SELECT COUNT CPhoducl ID) AS
NumberOf PhoductsFRoM Pedducts;
LG1 CEILTNG The CETLING O functien hetwm the
Amallest utesen value his i hiase tham
tha
h Caual ko a numben
Sntax:CELLTNG(numbe)
Teecher's Signature.
.
DATE:
PaGE NO.:

ExRekwn thu smallest integevalue that is restun


han r eual te 5.7S:
SELECT CEILTNG (5.75D;

CFLO0R:- The FLOOR) funtiomhutwm thu largest


integer valu hat is Amall than x eaual
ko a number.
Sptax:FL0OR numben)
ERetem the Largeat intnger valu that i Lu
than eh eajual fe ds.+s;
SELECTFLOOR CR5.15);
L8 LOG The LOG) Huntim hetuwms the natwrel Lesarith
s ahecihied mumbeh, or the Lozahithm of he
umbe te the ahecificd baue.
Smtak LOG(numbe
E Retwm the matwnal Logornitiom efd:
SELECT LOG C2);

(93 LOG 10 he LOGlo)untim hetwmt the natukal


Lejautmm e anumber ko bate-10
Spkax: L'OGLO (mumber)
Ei Retwm the base-10Logwrittm o :
SELECTLOG LD Ca);
03 MOD The MODO funtimhetwnthe hemaimder o
a mumbe divided by amothen number.
Spntax:moD C,Y) Toacher's Sign ature..
G.osssenhetnet
DATE:
PLGE NCp.

Ex Retwm he hemainden of 18/4+:


SELECTMODCI9,4)
Ci1 PoWER The PouEROunctitm retwmi the velue
o a mUmbes haised do the peiukt of
amethe mumbe
mtax POWER Ca, )
Ext Rettunn 4 haized he Aecond peuuewn.
SELECT PoWER C4,2);

Ci&)
ROUND:-The ROUNO function heumds a mumben
koApeikied number o decimalblacek
Sipatax 3 ROUND mumbeh, decimal)
E Reund the numbe o decimal places
SELECT ROUND C135.3+5, 2),

Ci3 DEGREES : The DEGREESL)undtin Canventa


Value in ladians ks degree
Spnlay- DEGREES Cnumben)
E Comvert the nadian value iuko dlegrees:
SELECT DEGREEs C1,5);
C143RADIANS:- he RADIANSL untion Convent a
degrte value inta Juadiams.
Syntox: RADÍANS Cnumber)
Ex Conven a dearee ualur inte hadiand:
SELECT RADIANS CIB0);

TeacherS SIgnature...
DATE:
PaGE NO.

CI5. SIGN The SIGNOunction hetuwms the slgns


a numbeh.
Thu functin uill eturm ene o the felleuing
I f numben O, it hetwms 1
TInumbtn0, t ntuwnm O
T um.beh<o, itHtwns
Syntax SIGN (mumbern)
E Retunnhe kizn a a numblr
SELECT S1GN (55.5);

[I6SARI The SQRTC)unctimhetuems hu suare re


c a numben.
Sntax SQRTCnumber)
EX Retiunm the 69uaeHeet a numben:
SELECT SQRT(6H;

CA4 TRUNICATE The TRUNCATECo functin rumcatu a


numben ke the Apecipied numbeh Gdecinal
place
Sspnkax TRUNCATECnUmben, decimals)
E Retuwn a numbes truncatecd ko s decimal plated:
SELECT TRUNCATE (13 S.315, 2 )

Taechar's Sian stura...

You might also like