=
Kinds of Computes entibrowment. The Sol tan pan
tobe a {thandaxd bangesnge. as it oblows 1sex3
te Lean pene ss ae and use it fo
Coceate, sobscieve ond transfere infermadi re
sagas leas ¢ whebhosr they Oe wooatng 67 @ fC,
Q works \on, 2 mini," Ot a natn fora rne
issn one numerous yertions ef SOL. “Tae oniginah
Sree ducloped ot 16M San Jose eagensch.
(ow the AlLmanden peseaxch cores) .
This_Lavguaze, originally cabled Seayol , 208 incplemerte
Tn Sequel Language has evolved Since then, and its
nae as charged. fo SOL. In 1986, the American
__ pation) Shendoxds Trati tute (ANSI) pebdished an SOL
_ Stondantd the? _use3_ a aeBuocessing Capabilities of SQL.
je OL has pocoued to bea
ata. Definition language t The SOL DDL_paseutitns
commands fox afin 9 ‘on
| 2teha#io7 creating indexes and rmuadifeing as
| schemas.
= pe sect ne Manipulation Language? The SOL. Orne
4, View Definition : The Sil DbL abso includes commands
—— _ fer def intng véew| ——_{ Shivalal
os Adluoretaationt The SOL DDL inchedes Commands fos
Specifying access scights tp prelations and views.
6 Tobegecity? Te. SOL preoutdes (Limited) forms of
| | rar checking, Exchre pocoducts and Standards
Q
es fox inkegecity checking.
¢- Frantaction Candob ? SA. induces temnands fer —
4 pecifping the beginning and endhé, transactions
abens uaéth senna ands to baw 2 Contyol vex.
praowsoction pacoorssing.
# | DATABASES Iw __MY
;
That is deop a database namely students, we'll
be waiting 2
|| PROP DATABASE Student }
.
| |
—
—___# CREATING TABLES
Lé- z CREATE TABLE Comm.
Thaker table £3 contated + its —calsans ase named
datatypes ard Sizes ave
~~ Column. Fach table mush haue at poard one colurm
+ fife long & CREATE TOBLE ommend, ake asta Hal Es
—Peient database has beor opened wig _ USE < chetabade name>.
> -Command gt
The syntax of CREATE TABLE
SYNTAX = CREATE TABLE
( < date type >U(< Size?) »»-]) 5
2 Create Comps. table whose scheme is a5 follows: __
| CompSc (%nthmo, St mame, Section, Marky)
; The S@L_Command uriee bet
‘| CREATE THBLE Sc
C seolino integer
Af mame cha (20)
Section chase (4)
H LAI. dateger
* || When we create a table ints
the vals that can be extexed into its field.
Tf this _is_specified , Sol. will safest ong vabiees
| Cerkered | cha-ged thsepugh. INSERT [UPDATE Command
| that violate the Cxitexta Wwe define.
# | Viewing @ fable Streectxe
2 i z We want bi
—— DESC CRIBE) command.
The _ Syntax of this Commend | 43 28 follows? a
NTA X DESCCRIBE] < tablename > 3[om 7
rm OD spaced
; |
gs Fox example, if we _wsdte, _
rt: DESC CompSe ;
(et DESCRIBE CompSe
; & i we
(te ta ble’s —_aaariet inthe dladesbate,
(a check what abe tables axe theses $n debabase , Simply wovite +
’ SHOW) TABLES 3
it woh. lez in
4 Bsercting pata. into Tle?
@. INSERT_ENJO Command
|The _suous ( turpis) art added fo seelations ueing INSERT
Command op SOL.
SYNTAX = INSERT INIo [< tobemn List >]
VALVES (, o--) %
eh te co _jnko 2.
=
INSERT ZINTo CompSe
— VALUES (1001 ,‘ARguN”, ‘A’, BS)?
G wslumms 9 phe
CREATE TABLE Commard of CompSc. The Sane can be deme.
—~wlitn an albeenate tommand @3 Shown below :
— INSERT xpyro Comp Sc. (wlhne, Sb name, Sectior
“VALUES (4oo1, ‘ARIOM’, ‘A’ Os )3@. tL Teserbing Nu vobeeos
|e inser value nui ina specific column, we can type
|| out wal thot quotes and NOL with be _insected in pat
\coleunn. i: :
‘| INSERT INTO ConepSe (soll mo, shame, Section, masts)
VALVES (1002 ,‘AVNI’, NOLL, WoLL);
See, fer Serie and masks colunns, NOLL Yates
| faue beon Insesched-
© |Tnscocking Dates
" 2 in _* - DY
Le, fisak fous digits depicting yeas, folued
ya ba hy wed 2 digits mo foe
2 dé 2 ALL this is
— ©. rset from Pmathet Table
INSERT command can algo be used to take ast descive
7 vo bee03 foseon. exe table and place then 4n_erothen
|| eB ole this
sceplace tre Values cChause with an apppse petite, Quory |
— a3 Shown in the fi Iloursong eat male 2 _
aa INSERT INTO Compe
| Select * FRom__Pem _
— WHERE —mard3s 7 BO 5
a Ee_wit extort all pros sows from PCM phat howe
raat more phan 80 aed Ensexck this powduced
A _sekuth into te table cong
_ |4 Modifying natn wth veDAtE lemmand
ometimes, we neod te charge Some. po all of fs valued
nan cclating wow. Tile can be dene usiog tne UPDATE
_ command of SOL. The PDATE Command Speckfies the
sows to be changed using pre _ WHERE Clause, and
tre bw data using tre SET Koyword. The neve data
can be aw specified centtart, an eipxe3dion 0x data
fourm oben tables.
| x exarephe , “to change pre maods, of all Studer to 95
we weed watte
UPDATE CompSc
SET masts = 9S ;
2 Of we wart te charge mass fo 10 only fase these BEES
: _thad howe msds 03 bss than 40 melas eee
- : UPDATE Compse.
= ! SET mast? = 90
_— WHERE anak < 70;
+ Dent fe_i3sgue Commst ; i,
ap-tere ama.ting changes
yo tab
L Ht Debeding Date with DELETE Commands
~The DELETE tommand semours rows fom a table —
Pb Tks premmoueg the enhiso sows, not indiud dual
) —___field values , $0 nu field asegument 43
. Tr_debehe_S: ptax_ig: DELETE FROM < table name>
HH RE x preedbionte 7]
i|
|
just as we te for gusxtios
|The. DROP TABLE Command
DRo; Lu Jy Xx =
I
That is, to_dewp a table CompSc., we need fo wsite *
oO |
DROP TABLE Comp cs
+ | ones HU8_permmard 4s gin, the table name is ro
llorger scecog nized and ene commands Can be
]
|
| giten on tat object.
vear z _ fete teble (Simple Queses, ee
~# The SELECT Command
— ad
| 7 =
_colecenns fren en5e 0% yume tables
{ekors ii_the Keyword in SOL, which tate pte
_—_-in_cuey SELECT Glsery .
'___Syntan? SELECT vc caus name 7 Cxtotumn namers+--)
| FROM < table Name 2 3
| ewe guy a8
| ELECT si mame, soebien
FROM ConmpSe 3
+] :
pees arrears
[ep a tabi jue
| probusrans. Tic aidochk (#) con be ubstituled foo a t
pamper Disk of colwnrnt 0s fobbouas ¢
ELECT _* FROM Comp ses {
“Selecting Specific Rows — WHERE clause |
Tie lait classe in SELECT Statement specifies the
—lesed host olocBien nat tenelactted.
a —~- _[me 7 /
howe [2
Shiver
SELECT [,
FROM < table mame
WHERE < condition
Gl
WHERE -mascks 7 #5 2
T
end ita Based 7 Range
he 8 opexatos Sofinos
The sane inchede boty Lowen Valeo and eo eee
[Fax example t To Dist tre $8 name whos sol ne faves
a | hebweon 1020 to 1035( both incushe), the command ist
i SELECT éeorte 32 mame
I! EROM Compe
| WHERE soll.me BETWEEN 1020 AND 1035 ¢
__* The opomaton [Or BETWEEN is seovescge of BETWEEN
———pepenaden.» tak is, the 20s nat Satisfying te
{BETWEEN condition ase sphoteued.
Condition based paeaeeee
~——To_specify a Lish of values, Iw operate is sed. Pe IW
‘ae -WHERE So tien IN (‘A’) ¢
mph _rmatd) Lowexcage character , 0% seco -vex32-
L
—ilé
Lidge ho!
& bataira. fox txarnpale: ‘fidge’ ‘Beet, “ 7
"makoies any Lbcinp of exactly 4 chaxcetes.
ee! atlas ay _thning of ob Dash 3 chanacted(rami |
{ Shivatat |
* The LIKE Kegunsd is used to solocd swows tortabeing
——urlumns thaP match a wttd casd _pabteser.
ie c b z
table sating IO NUL in the WHERE Claw.
* ati; ike =, <>, et 1
= swith (NULL)
I Eeampse + To Ligt dolnits of aL storame where marks |
cordain Nui 1 (3-e-, ren -vobse0 ) ue Lege the command 2
—> SELECT sh mame
FROM _CompSe.
WHERE anascks Ie NOLL:
*~Nen - Nubh values in a table coy be Listed using ZS
1 NOT NULL.
| Strbing Pesutt = ORDER BY clause
I a EC} exe &SELECT < colemm name Gc tokeinm name> s+]
FROM < table mame
[WHERE < prwoticate >]
CORDER BY < Column name ou
bye thotr nares.
4 Elect * FROM ConpSc
ORDER BY mask? DESC, SA mame ASC?ot)
| Ce 16. iat
Qa ghven colunm 07 exps03sibn.
I 2 DISTING
| Asgument type t c
I Aotusrm value 2 Numerric
Syntax AVG ( COLS TINCT ALJ)
AUGL)? This function computer re aussage ef ghuse dafa
‘D | x is if aint: value
a_giuen colin 0x expses3ion.
fe : C)
__Y)) mpxuU: aa faacbnet_tucdinot the Dadi sal fam
a gluen _colteny 9% _expoeSAebn_______— a “Shivitad
: Syntax? Max (COISTINCT [ALL eepx)
|
s 3. — S
|| 5
lke fon.
COUNT (£* Cosstiner J ALL] expx})
+ Tf we Specify i
0s urhere cape, got yutl), We C27 Chunk ef hore
Wh ws Ould disifack values of capi
- “i é fe nell.