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

SQL2

The document discusses SQL concepts like SELECT statements, JOINs, UNIONs, and views. It provides examples of queries using tables with student data and explains concepts like creating views that always show up-to-date data from the database.

Uploaded by

cruzloveoflovers
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

SQL2

The document discusses SQL concepts like SELECT statements, JOINs, UNIONs, and views. It provides examples of queries using tables with student data and explains concepts like creating views that always show up-to-date data from the database.

Uploaded by

cruzloveoflovers
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

2-28-3

Retw Aeods that hae Mateing.


Valus u both ids

SELECTcounus).
EROM tabl A.
JNNER JoIN table B::

SELEC t
FRO stu
INNER JoIN cose e*****ete**s+eeeeseetes c.
ON S. studuut........*e.**
id C. studutid
Col-uae
t4BLEA fko4
CouuS). Colw SLLECI
Syutox
cotko mathed table
Retuns
al
ON
LEETJOIN
B. tabu
table. EROM
Coun
(S) SELECTbyatax.
teble. ight kou lords
***********
mateld the tablu, at
***********e*s***** *******************
.***.*..*.s..**.*.
Ceods ll
Join
ful Toin
Retuns al vds ohu ttuw is
Qmated

Byudax
$ELECT.* FROM: stu ass
ete.es ....... woe...ereeseseeneeeseese.

LE PTJoINtouse.sc.

UNIDN
SELECT * FROM.stu as..
RIGHTToJNcoUsse asC
ON S.btudeutid C.studi did:

LE FTJOJN

R1GHT JoIN

|PULL JOIN
Rid
NULL. C-id. WHERE
CouL. joiu. LEFT
EROM.Btu....S. SELECI
joexelsit
la Rigud
omuauds
to. SQL WAit
TABLES.

8tudutid
adau
ID2 bob.

Btudutid
I0 2.
euglisk
moths
eeee seesee eeeeeseeet

Couputi
Ael_Ton.
Exauuple
id
********* adau 103
ID2 I04
bob
***.
vuel
I04 donald

adam

bole

SELECT "..*..ees.*..e*.*..e.*..***e*.*..e**.
................

b. uame
...............
JoIN employee ***..****..*.****.e..**....

DN a. jid = b.
b.
ee..s
manageid;

DOMS
.....

adan
douald
donald

UNIDN
Combinaelulttst
nosELEeTstotuents
UNIQUE Lde.
.....s...

To sL iti

coum must haue 6i miladata tykes.

SELEeT coeuns FRO tabl 4

SE LET
SQL Bb Queis.

..............

...

ft ivles 2 belectd statuuts.

SELECTBoluun(s).
EROMtabe
*.*.....*.. .ue...... nan
WHEREola Que opLAOIAL

Exaupls ********mN

Quil 18
oll studuts wlo bhei ka
*..*.ees...........
93
.....................
cutou
|4

92
92

DoMS
studua)
Floy(maules) >(SELÉCT
ag mels wHERE
**************
Atudas FRo
mares SELECT s*******e*****#***.
DR
)74.333 WHEREma
uduts Feoy
ae. SeLECT sty
74.333
FROMtuduta;
SELECT
Exausl allAtudut
n a...............
s

uilt

**...**.****o..

ctudut
wett .**..eseseees...

MYSQL Nieuos
> 4 view is a wirtual tabl based
e ......

Btatmuut.

CREATE VIEw
SELECI oue. naue. FROMstuduta:
SELECT FRbY iwl

74 vius always khow ub- to- dat


data Te database eegie
&eatis
...................e..
Vieo
....ese..

DOMS

You might also like