0% found this document useful (0 votes)
191 views9 pages

SQL - Basics - Handwritten Notes

Uploaded by

manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
191 views9 pages

SQL - Basics - Handwritten Notes

Uploaded by

manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 9
© Date Soy stands fev Btrucduxed Query Langvaje Fo) esau! toa standard lanyqye for Raessing and Manuplatiny database: 9 Sou stands For Shvcluted Quay lanyuaye A dolabase Most often cenlains one or More tables. each table identiey hy Name (eg. Customer, student). table Contain tecssds (wows) win data: SQL Cade gtatement + Woy Ceente TABLE table-name coumnt datatype, Column2 datatype, Column3 datatyre, \; : SPL iS mot Q Cage Sensitive lanjoage lect Jetqernent ue so. Select dasa Srrory dajabase. . * data ead is aimed in Result table. Called tne vesult- Set. Iqne Pottowiny SOL GlatemMent Selekg tne ‘Cugiomexname’ & ‘city’ column Perm Oslomey table: a Seleot Custementvame , city Fam Customers; ill selefs all Column Pom CuSbomey table. ' ‘i Tre WHERE clause “Il§ Used do Pitex BETAS e i+ is sed 4c vextract only snose wecesds nat PuilPited Q gpecified ~ Condition = ivhotsb! bh SELECT \Columnt, sColumn2, Rom dable-name WHERE _CONdition ; SL comment + + BQL Comment§ are used, +0 add Notes +0 WF Code example: -- Ths ts a wmment. (err Ane AND ocpevatoy disploys a werd WPocatl ute: Gonditions -gqmeted by AND OIE TRUE 0) 7 IAND syntox: @curiovs- PR rarome¥ HANG EE YP: VOL IID) Selat column!, column2., 27° From table-name \ where conditionl AnD Condition2 »----> a) ! 1 qne of Cperadoy \gplay a wrecosd JC any of me cofidition geprated by oR iS TRUE: on Syntax Geleet columni, Column2,--- Ram _toble-name — aa wyeee CONdIHon! OR Ganditon2, «++ Ane WoT Operator displays 0 Becovd ~~ \@ tne condition(s) iS mot TRUE: auntey ~ 6ELECT adlumnt, Column2.--- PRom table-name WHERE emdttas!, wot Condition ,; example * 1 fic SELECT | & “FROM * CUstomens: WHERE NOT County = ity"; @comious-- Pregoammev lezalbs Sane DY Speraio¥ alow You to Gpeeiey Mottiple values In a WHERE clause. < ‘Ihe tN OpewatoY 1S a Shorinand GY Mmotiple 2 aonditions: - D5 wD ' syntax : SevecT column_name) Rom tablename WERE Column-Name ar (valve, values). e'The BEWSEEN Operator geleoty Value wiinin given wange dre Humbe can be text oy dates. © Ane BETWEEN Operator is mMdusive: {— begin and end Valvep are included Suntox : SELECT colUMN_Name(¢) FRom table-name WHERE ColVMN-Name BeIWweeNn volby AND Nalve2 + ACUMOUS -- PIopammey «the LI¥e opesator is used in Ga WHEDE clause 4o Search Pos a Specified patiema Column Mere Gre two Wildcards offen Used in a Coniunckon witn tne LIKE operator: c- the perent sisnCy.) sepregent zero, One , o8 MLHDle Chorcter. * The underscore Si9NC-) Depreyent onc Bingle _chancler. | T 1 Suntay : SELECT Column!, column 2, ---- FRoM table name WHERE — Column. LIKE Patterns Ue | SOL Jory Caluge take ~~ wecsKds Faom > two Gt) move tables in a database and combines it ogines. ArvsTi ipiandaned SOL defined | S TYP OF Toins— | Ty inners Join 2) \ef+ ovtev Join 3B Bgnt wovtew Join G Put ovtey Joins! 3) .Cwsss Joi n ie Yue > @cuvioS-- P *%yrommey tablet > Ce pane i inners Join Tne INNER Soin, Kegword elects vecoyds anak Wave Madching values in Bom Tables. euniax: SELECT _Column-nameG) FeoM +ablel winnee Torn table on FALE. GluUmMO-Name = table2 - ep) umN-Name; the left Soin Keyword Behan all ecards Prom tne lept table Clabiet), and The Matching “Geards' Pom te wignt table Clablea). Qe==0 tre cresult ig 0 records Paam tne signt “Bide iP dnere. fs no maton. Synox : SELECT ColumneName (a) Prom tablet LETT ToOIN table 2 ON TABLEL. Golumn-name = 4able2. Column —Name ; i curious —-PrysammeV a ene a Fhe Right Woin “Key Word etwveNS Ql] BETAS Perm! wight tobe CFobier) manta matching wecnds Poon tne ler! dabie Gabler). the Besutt iso gecosds Psom tne_lePt side if 4neve te ho on che | 1 Right Toin Gimox : QQ) yea SELECT Column- Mame Cs) RRomn ‘table! Dy oo) or RIGHA Yoiny, Fable 2 i On Fable. Glumn_name =4able- column- i IN name ; @ewows-: preysarrme¥ ~ Tne FULL OUTER JOEN Keyword wehvons GN Becords When herve IS A Match in leer Cape) oF aight Clable2) table records . PAHS pir note: poll outer Jain and Ru uvoin Ore Same A, \ \o Pun Jain QMS ~ Poosammers. suntax » SELECT column-Name(s) Prom table! Pull ouTeR Tot tabler on) sable! column-name =tabler - calumny Name, WHERE Condition; @ curious pooyrammey- ey

You might also like