0% found this document useful (0 votes)
32 views10 pages

Adobe Scan 09-Dec-2023

The document discusses SQL commands for managing tables in a database including creating tables, inserting and updating data, deleting rows, and altering tables by adding or removing columns. Functions like TRUNCATE are also covered for quickly deleting all rows without dropping the table structure.

Uploaded by

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

Adobe Scan 09-Dec-2023

The document discusses SQL commands for managing tables in a database including creating tables, inserting and updating data, deleting rows, and altering tables by adding or removing columns. Functions like TRUNCATE are also covered for quickly deleting all rows without dropping the table structure.

Uploaded by

Sachin Jagtap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

E t Lnserst student CSTID)_VoluesClo62,(107

Clo8)

E pcdole. z updating al 0ws data ina.


toble ata ime ot a specife 0c dota
n a toble by using Whene' Condiion
Syrto -
Update<Toble Name> SET 2 columnNune 1)
<valae l Column Name2) <volae2
[Hhere Condihom]j

&- Hite a a quenp to updote employeejob os


as

HR, Salay as_ 4 000 whos employee


Numbers is Tn88
uplota. emp Set Job =CHR', Salaay J4000
whest EmpNo 2788

Ei- oite a query to update all employee


Commihon as_50o
Updote Emp Set comM : 500
Delete -_Deletng all ows fomthe
doble ot o_hrme or a specifc from
whére. clause Conditon
tha table. by Using
Syntax CHheae<londitonj
Delete ffom <Jable Namo)
aite a auery to deleBe employee fon
Ei- Wosking jn the jobis
the tab)e coho ne
cleosk.
Enp Whese joß = cleoak '
De letc frum
Ex!- Wte_a to delete..all emp
queng
details fom the fable
£Delete from Enp
Diffeencbet eem delee ¢ Tam Cote

Delete IamCate
OTt is DML OPesohon.

T Can delete a spedßc| Hisnotpossible.


Dw fom the toble
Jt SupportHhee It dosent Suppot
-clouse Condibon HbereJouse Condison
Ostis the temsposay
--data deleton 0#is pemmamt
doto _delehon
6 IWeCon desto
We on hotocstoe
deleted_ooto
o)lbock by-usi ng deleted cota bjby using
go)Jback
6)
Note. s- Tn the above query eomple
the emplogee. smithSoleg is 8o60
`o thot
thee j6 no CommisSion
is Bo00 only but it
Salay +Comm

To overs Come 6oith obove.


-bblemcwe should Use a prcdefned
fumchom in saL Severs Is TS Nul)
fmction

s Nul episeg2)
It is.o priccefnocd funchon cohich is used
to 3eplae a a Users defned laiuos in placa'
- This fimckon is höving Hhifol coing twoi
ormgumemts.ne
Jf epre ssjon is Null Hhem it Etucns
esphrssior. 2Noluo- CUsex defnec V Jues
tf esp-js.NotNul] hemt eet¢ms
sion1Nalu 0n.
-psession.
E SelectTSNullCNull ).AS Result
selecTS Nul) LAu)4loo_AS.ReSUt -- joo
aelectT5N)_r0.lo) AS_eSult--0
colect_TS Nul]50L0AS_Result go
2

Cvey GoLstatemnent Shouldendscoith o


Cvey
iCOlon but t iS ophonal in SaL 5erNe.
S blamguages of seL
ta Defincion languegqe CDDL)
Coeate
Aters
Sp Remome
Tmcote
Droop
Dota monupulahon language coML)
Insest
upDa te
Delete

a @uemy Lamguoge C DQL)


Select

Tsonsocion aol lanquoge CTCL)


" Cornmit
RolLBock
Sovepoint
Data ontol Language. CDCL)
Gsont
ODDL_CDota DeAnohion Longuage)
This.lomguoge ommands- e usin to defne,
Dropom-object 0t dotobasefom
Modify #
S@L Sesvers.

Goeoing onew databose c n e


toble in soL Serves
TStepi - Goeote O_nec dotob ISe in S@L Serves
Symto - Cacate dotobase <DB_NADE
Cocote_dotobaseMYDD 3

SBep2 i- Select The oequired dotabose.fom


SaL Seves
Syntox s USe <DBName>
USe YDA:

5tep 3. B- Cacate new toble in dotobose


SyntoL 9-Gtote. toble<Toble None)
CKColunon Nanmes <I)LSi22],
L0T> Csize]---- LColuonNome22
Ec -CroeoteToble Jo06_Columns
Snome 5udemtCSid_Toti
AGnE choxC1o2.5fee_Decimnalct,2
Tinyin+)3
Stepy. 9-To View the
Syntax Stucturtoftab
SP-HELpLoble Naaa
le
spHELp Shdemti
SQL Cstu ctued aueny Languoge)
6QL.g- SoLis o non ppodusal.Languoge
which Was imtoducod by the IBM in JIIOS
Which is vsed to ConmmuniCote coith dotab05e,
50L

_ ocate
USers Tnsest

upate
’Delete
H Select

-5@L is olso Colled os Sequ eal o& CLI lonsquoge


CCommen Language Intersfoa). This is only
the longuage which Can use to Communiote
with any RDGms ppduct.
OaOcle

SOL Sevey RDBM5


5@L pruct
USer

SOL.is not CaSe Semsiive lomguoge thot- e


on cte S@L-prcdefned queies
osGyntoxes
jn Gny Case chosactetsCeitherr uPpers ox
acate &- Deleing mwsfrom he table but
not stuche of the table.by using ncote
Csmmmamd cweCom not delete a Spe Cifc 00
thetab le because tdosent 3uppout
whereClouse condition.

Sna - Funcote tab|e <TableNone:


i-Tmcate toble Gudemt

Dup S- Doopping-o table fiom odatabose


persnamty
Syntaxi-DoDp table L Table Name z3
B s-- Dop toble shudent i

DDMLi-(Data Mnupulaton Language


This language Cammonds one Used to
Chamgeot monipulate doto in database.toble
1) Tnsest i-TmSershn a De Dwin to a
tableThesc oe to methods to insest
Dsoto a table
i> Tmplicit rgethod - Tnsesing cll
Nolue's for al Columns_intoa toble CoHbout
any Column)
Syntax- Tnsest Cinto] <TableNcme) Values
Ec-Coeate table shdemt STID Snty S
Noscha C4o), sfee decimal CGa2)Age SNma
tinyint
JnSer+ nto student values CIol,.SAI',
2500 21)

TnSest_shudemt VolaeS Clo2TANES,


4500-). 23).

i) Ecplí G+ rdethad - Jnseakng: Nalue's


fox equioed Calumnis cmly Coith left any
olumn.in thetoble)

Trsert+ CINTO) <TableNmes CRequied


Column NoneS)Na)ueS_Clo3 ALLEN).

HoltoFosest Muliple oDs_jnto c toble


Syntax fos implid+&=
Tnsest [INT] <TableName Nalu.s
Nolue S) CRoo2 CRoc1
Exi
olaes)
Tnsetinto Shudemt VolosclO4SCott
80022),C lo5.Wosd' loo0 252
-Syntox for
Tosert ITHTA
bcpls.cit i
LIER S- To chonge ot modifhe stache
a table 0 a cdatobase
vsing the Altes Command we Cn perxfrem
follewing fbux operahons. on existng toble.
.ie persfotrm these opezohcms. we Drquited.
Sub Commomds of olten
i> Alten- Alters Column

iii)5p-Rename
iv) ALTER- Dbp

i) Alles - Alter Column s- To Chonge dototypef


olso Siz0.of the datotype ofa perHCula Column
Syntac -
|AlHes toble <TN>AHen Column <Column Name>
(NewDT) CNec Size]:

- AlHe toble GhudentAJtes Column SName


Voschar C50D;

add
i) ALtes-Add 3- Adding Onec Column to
cisting table
yntaS-ALte toble.<TN> App <Neo_olumn
Nae>DTLSieJ SAddaeSs.
AtesTable Shhdemt ADD
chonge.a.column no
SPRemome 8-_To
-11) indotabaSe
Os0 toble
A)_Syntaz _ngme Namefn. :
to chonge 0. Column table.
<TableName.loLD. Colunmn Nom
Sp-Remome
<Neo ColumnName)

tzi-Sp-Remame cShudemt5Nome Studen.


Name S'

B> Synta to chonge o toble narne.n doBabose


Sp.Rename t<old table Name,Nes toblk
Name>'i
bi- SP-Remoma 'sdem', shden tdetoils'
OR.
Sp-Rename stalem tdetails shuden

iN)ALTER-Doup
the tob)2
8- Dnping-0olunmn from
Symta- Alter toble<Toble Name)
Colymn <ColumnName.
EsALtex table Shudemt Dp Column AaE

You might also like