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/ 24
Fpenmen
4\iro: “To inoplennent Dol, DML & Del.
— Commands
vy
oe 5UO vab Py
on rfoswoord + oot :
ensq > Create dotabose 16985
Quy Ok, 12d ay ected |
mu 4, > USE 1b9Gey
Databore changed,
my Show, “ables;
| Seq
Mysql > Create table Sudut Cid inher name
( varchar (205)j
Query DE , OWS Affecte
ma eee into Godint Cid name.) Values
AB," manasa’) ;
Quey Ov, LOW gpfettecl
| mysgt atte table Soden t add bran ch_ Yarchar
“bul Cio),
Sueey Oks is abject ed
YCtorap~“. D dopliates:0 roarcings :0:
egg > attr able Stodent Change branch
Cpt VorcharC 5))
Auery oy 00 opected
stCords-0 Dopliatase wornings:o.
mpqoatier table Godent lop cl,
Quere Oe, 9 rows agfeeted
Yelordy sd Copliotes 0 went é
rope alter able add Addrews Varthar (ayy
iw)
Suey Ok, 0 wWws OUjec ted,
PO
my Sly wename table dtodent 9 Claw,,
Query Ole: 0 eas argectedl
roupsal> Insert into claw Cid’, nave, odclien )
Wilts (2,* xyz), “in) (3 i ae
Quy oe) 2 WS, ayyect ec\
eat S Sdeet * from Claw
yb sao MARE afd he
1
!
[ono Mlandsoc}) Now
2s xyy iad ;
Bod Hee 4 osha, 2
rouaql > Updat¢ claw, deb addten = 4 hen
Buen oe’) lyou Ogefecte ‘
Rows modtthed: Cha
st Woecing 0)eegql > elect * font Clay
vr fave adds)
a “fanaa: Ad : |
oe ABU “yd
a ma “in beh
rag? PPI
| Gury oy 0 MWS oped
aniVy START TRANSACTION 5 |
L> INSERT INTO. Clas Values (Ph ;
espa ae far Clay; “
Nj oe rare ' addrery \
\ fee \ enon. WwW ‘3
Aye | ANY
rch YS, ABL yd
a 1 oh bi OBEaly vx |
ay
Myel ae
a)
Z
5 as EW !
WS}E7™ SAVEPOINT ene,
ovr | RollBACK ToS OPt',
| adsqy7 CoMMiy’
Roll
| f Wa 7
To S_one.
aN) e oddreny
\ : |
VSR yet) Ceao@sa HID
" [ Sa xYY HY) | |
Pa 3 noe. AD )
oe 1 + DBL V2Ag. BORNRIES
Aime: an {ropkennest fi Constant. :
\
anpary ey :
ane Crate table en” ioe id tot» 9
oa NAME vow Char guy kei
Sur OK,
Ant Ce Cid , 1096 mame )
me SIL insert”
value (18, tRanhi |); |
"tes Leet is exoployee)
age. rame |
Ul i ue bash
Np J Ao ereploye , 1
| Fld a ott vi an
Pad) ioted No | pit ntl
| age 1 tot) | 46 | | Nott
[eaame cexct708) “Ye Null |
‘nto e 1 y, DOM
“emp enc v)
igkat “entenyioS Uecgoep
| - Dopl pin q fe o
ONigue: int UNtOuG
a qu> Create rable Cvs Kot ye
Sreme Noxkereo Yale C ; Sta; my
& into Custore Cid, Snare)
mie” inser
values Cv Sabe! Lesa)“EP See ck “frm Customer,
vA_| drome!
ry Labe |
Ah | | 2 AF ge sl Cid 1 Srame.) Vous,
Mase yy
« Pre
ait : thos cones ponds
ror: Chev “the oS cecal
ie We a ayo +o Use near Ci diSnam)
dhe right es
Valu» 3) uy!) ot Ifne!
dese Curt! fea Geet ‘stom ANTS), ,
MP es a5
Lupgenc_ [ Clep
apogee oe
Value Cube)
ot delet, * cron SANIT)
1 nar & \ dep | !
[ORO I heses |
, Vushu he cscNoinvll:
ae Cr
npg that fore
roypquy DeGras EAP LI —
Seal aype Nee oe =
fad “Bee — 7
i
wt). ° M MP . |
id
Fy cornice ae |
faslke hie fear
RM
Y
coke Hable. Emp Cid int
NoTNotl
age ' int);wie Create table Account Caceno, int, bala
int , pnmay a Coce Dy
imat WoO account Caceno, balance) values (ios
| ee due account Bee)
| Paid ure Nott key Pefaull Fura
mc) No PR Novlt
aceno
balance tot) U6 Noll:| | fa Sclect “from QCCOLNE 5
Py
¥.
J
accno | Kolan'ed |
Bee eeaee)
}
[1234Sereq | 3001) |
j—- -— —
Branc B:
wee Create able branch! Cor nance
i OC an vac has@p)
it charC20) Cts ha,
Narcharcr0) » br- Ct var ' 0)
Qceint » Prnrany keyC br -narre), forego bey Geee)
Neferwmcey Aclov+ Caccho))*
lees du bran chy
PS Bay,
)
aie f e
) Feld TYPe Not! ah Oxfouilt Fecha |
I by-roree | vehorca)| no | PRE wloy | /
) br name | wchal®) | NES) | Kol
ase ts | Neharc20) Yes ; Nol '
Qteno! | int!) Me Mot Molt
me frist Anto branch! Chrlname, bracty awe
MC t rye rea
ee ave} » Abmslab’,
tn3qser84) 5
mo 4sqL7 Select,
ny branch;
! ie Ge aby i a ot)
brename re Gin Ayes oldelte )
Ge a
[— ;
dba vizaqg | loins / asysered.!
ee ee |
loan: “
yale Crate able loan Cloare gint 4 aravort ot,
brname Nove har (20) 1 Pherae bey Cloans) ,
orc n ny bre name) Teferen ces beanehy
Chr— ham yymoysqu> aloe \van;,
ee — - 7 eee /
Field | Type ( Mott / vey! Cent Atra .
Loano J tate) | No “rd Not /
|] Ye | \
arson fat) ) Moy |
ean cored varchar (os) Ye} Mot y Nowy |
POYSILS Tower tnto Loan_Ctoan no, around , brnam
‘i Volus (34d, 5000D *cRR') 5 al
ee < Sdeet oF fom ee
| toono ormpuat | benamet
| [aay | em k SNP!
' Cu sormer:
i hai Create -rable Coste mer Ccust- nae.
Vart ha yl) » Cust a Vorthar-C 79) » Cust she e
VowcrorC) 7 Woane Shey parese| Fe) custrany
fori key Cloano) ve ferencey me)
ro Yas doc Yo Custoroer,
| Field Php | Nott! 4 art Ech
Eee 7 an
Nott
ustnome Neves), no
Cust city 4 oe ,
ecxcat Ne :
\ \
4 Mie el ‘wl
wipsqt > there into
sto nmetrCaptram¢,
“ Curt — Shred , A Chass Cit oy loonn) SAWALY "hor
Mpa bb “yd” Buysslg
Him: iroplemnest SOL Fonctiom -
{I | Agate ROS
4 raysat > Create able Styden tid | tat, came Voschor
mar js int 1 aq¢ t
ap mvéct into Student 1Cids nary, wer Oars 0)
Natu (1, “‘uohn’, 60, 15
sq Guleet ANG Cena) Fora (shodeot );
| regener) “)/
= 60-0800 | ;
mysqe 7 Select Coonrreage From Cshodent 5
! “Count ve?
mpg? Sc Matcage )4roraC shodertl) 5
mT I).
ee
rays elect “punt CMorefort Cstoclentl),
Traut exon 6
bo -
bi deck AMC Mans) From Cstockotl)5
|e a Crore) |
{
pas@| had insert ‘into Gtoclenty Cid ,name,.nparts .
| Values C2, “Prana” go, ee
rays? Select youre name From Cotudenty
" UCASECNae)
\_ Town :
1 Wantagh atl),
myn ees Lope Cn name Roms
'
\ “Leasecnars)
coh os
MANA | podent
ect mn Crane 43) From Gs 7
|
| repays Sele
‘a MID p crame 3);
"oh |
1 AN ! fr .
e zuct Tener tH Cname)-from (Groeest!);
nnlA9 7, Se
i | ent C
= |
} 4 '
wore)
)
Roorit Cranes) Frorctockrt
ond “(oge)
— /
| re
| (e_ |mpfr Selat Nbwe);
Now)
204 ~b8-28 1p 18:02
roypa > Select Manne fomvat (Nowe) sory-076))
chor Cstudinty
Iniame | ferent (r0.00 0 or 06!)
= a {
) gohn 20, 24D, BIH) 103-474 5 00700°
| ManFSH | 20) 24p ,8% tory HST 0 0000°
He |ag?
A Nite Quay! ; ou
fe sane pul aun ty. a query ie
| Gere quey embedded roti. Yt +The
Enibedded. Arey, fs called 0 Soba.
| Gets
| sage create table cstodint Cid tnt, name
jaar 30) 7 Clasp int »pmarys ys
af tngert into’ ake “values a Spec’
ay yy
ee insert ircto a j ite Ram",
32 2D) A
mi insert ‘nto ‘hoclut Values (3, John,
i) bpd: 2Y4)5 ,
; mal? Ap ‘isto Sdodest values (My) Jai”,
2, YSb)s
nayigly Seleck Efren Gtodet 3)
EE I ld ey ‘ed
AUPE I OIE) OFBE ; ey
as} (lean A) ox Hold gayope
Y Jai 13122) p° Wd ye
mysql> Crate. lable “ttabver idl int, name.
rchar(20) » Gubject! varc har(20), Claw td
Int ' Salary wat)MY AL> Ynsact
( * Comper! 13, 5000);
myaur invert “into “Taher Value 2, “Reteha'
“Science” 1) 900°) )
into Teacher valus (31° priya’
mysguy Insect
f" “Soual ” , Nott , 460) +,
bp Galo Pepa Mebeben ses Joy
Id Marne Sublet Dine chalary,|
re Bron Computer 3 doo |
2 Reha ge aie ( ébov |
86 cw ith odbedal Now Yoo |
ike Crate table Clas Cid bint, Q'ade inf
Atauher id. tnt, Ho of stodents Frnt )s
Ly tnsact? into Claw Values (4,8 2) )5
enyaquo insert into Clan values (913/40),
myig> imet into Clay value (3, tol a8),
Query Sulect Ave, Cho of Shodents) ofan Cloy
where -teathelD IN (Select id mi Aeachey
where a “Stiente OR ject = {rnactns’)
rolvac vod) !
(
nto “Tathy Vvaluy ( 1," Bhan},
R Up-v000| Quan d
ee
Select Yo Modent! vohere “Claw t+ (Select
Td fiom Claws wheie® Poof Students = (select
MAL Cno Of Stodents) frome Clans);
Lei’) atl peal
y tcl | mame! clowd | roasts:
1 3 Ly gphkpooe | |
ote eres
Wale ermpeyees Caenp td 1 +
my OC rod ¢
Erop_ Name
ie Invet
vf > Ingpeat
Var har C70) Adept id int) 3
ato Eroply uy Values (17 Jobo" 1);
toto Eroplosees valuey(>, “mary”, 2);
into Employ Valu) (2, “'Alice'yg)
into Employ valuy (4 "Raa
epg
et |
\
roql> insert
L> Insert
repo, seek fe
emia Empuname
any Soho
| 3 ia ae
x PW | \
iH Om
My
Hable depbelments Cdept id tat
“ry als Create
1 dept nome, Var-chert*9)) jMugs insert Into Clepaitinen ti 1 ) dala”).
MAGES Imert into. Cepartineats (2, “nmarvedta ")
| yl> Imet nto clepordmenti(3) Finance’),
| wv ie Sele Ffprowt dk fortmen ty
PBs oF {
| depcid —\_ deptrame
rl ! Hey
|) He | tracveting,
ar i — Finonte at
Wee Create Hable Sates (gale id tat 1 Erp id if
Sale_onyt invt)s
mysql> Mat into dalw valuy (1, 1 lod);
endegts Imat toto Salo vals (2) 2, 000)
mnysgey (Mt inte Saly valuy (3,3, 3000);
rp insert into Sales Valuy (t1,y,4009);
Rey quy mut into, daly values (5/5209)
fab suf sole;
-atn}~
rs te pemp-icl if Sale-amt)
hay ‘ : tooo
: "2000 |
3 il
Y 4 | oy i
I Jo :
| & I 1 Yous > |
- Vang (oe |
Gu: Fincl, the names “at oul £eployus ts
| holo, cept
lbye
WOYAL> GelecE Em p—nare poe oop Yy
eee deptic Ww (Cileet pti m
depactrnen+6 vokerey dept: names Sale!)
iGur,
t
fed | 8 came of all ‘einployers
who have mode ‘a sale.’
tr belect be rep_naene Aas nares Svtity
fom / 6 dents 54 1 Htoddoty 4p) Kee Sqride>
So). AW
eapa> select Student:
ne tod
ie en Steen fit name
afe where Stodent.ST
Ly duler join: + ay t_AAME
Sclect Stdenb -admno, Ss ud wn on STA} |
Hrom. stodnts yt Outer Join
Adm no ={er—adm-N?4
|
2) Right outers”, : wet
engsal> deleet Students acten no Stoden 4 -f' a
rave fom Student vig hs potur join-fee On
Students -adm—no}
reipal> SUtit, aden-nd eto Students union
elect adm no fom order by” adm:ho -
al,int 1 NAMe- Varchar(9)
| Orcler
mobo fable’ dew Cid.
aqe fnt; State varchar (30) , sal int);
mpl ‘insert
tty ev ali (b ,° Jobo", 19, ‘pars
aoe yy “youn”
roses unsere eto Cv values (tr "Tents, 23}
mysal> insert ‘nto dev value Cy 0M", 335) toa
6000); ,
masa Selat name sates Sal from dey
ae wae AES Oe
cane sat. |
bh Maroc
| John aris 207
—! fone Your 100
Ram | on. | b008 |
ld AS Pa
diode order by.
btate | sale
Youen | 3000-000
(
p pois | 2000-000
[wo oe 000 || Gr:
Oy alo Create fable (eanteid
| ie cess 1 job vartborl2) »
| aT int) ;
hy t into Cust va
tq s macrt V7
me
saty OM
Py
1ues (tol, wpeter,
e a a)
a8 quscieserts i BG wales Clon,
5 ausoinyat ito. Cust) Values (10% ; doseph'y iD
| : : y 8d
Jropauy glut nancy Job, Wat ne ee values Ctr tor, “laptop Bat
nto ay Ke Fs
[rofear mst Tee os Slay (s to die eh
s9u7 wsect tot ody vals, 104," iphones, ne
a?
_ ee
| name ee |
yt Par
| cpr] pe)