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

S0L Cstucturcd Oue Languoge)

SQL (Structured Query Language) is used to communicate with database systems like Oracle and MS SQL. It allows users to perform tasks like creating tables and databases, inserting, updating, deleting, and selecting data. SQL statements are not case sensitive. Common SQL commands include CREATE, ALTER, SELECT, INSERT, UPDATE, DELETE, COMMIT, and ROLLBACK.

Uploaded by

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

S0L Cstucturcd Oue Languoge)

SQL (Structured Query Language) is used to communicate with database systems like Oracle and MS SQL. It allows users to perform tasks like creating tables and databases, inserting, updating, deleting, and selecting data. SQL statements are not case sensitive. Common SQL commands include CREATE, ALTER, SELECT, INSERT, UPDATE, DELETE, COMMIT, and ROLLBACK.

Uploaded by

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

S0L Cstucturcd Oue Languoge)

S0L SoLis onon poodmal. Languoge


IBMin 137S
which was inhoducodby the
Which i s Used to Com muni Cote ith database

SOL

Cocate
Use Insemt
UpDate
Delee
SelectE

SQLi5 also Colled_0S 5equeal o& CLI Loguoge


CComman Language Imtemfoce), his is only
the
language hich a n Use to ommuni
Co
th any RDG MS p2D.d.ucE
Oaacle.

S0L SeverRDBM5 |
S@L_ rduct

USes my SaL

SOL is
mot Case SemSiive lamguage tho
e
on wte S@LPcdeined queies ox
Smtoces
inanyCase ChoaacteS:Lethe DPpe_ 07
Eveay
soL StaBememtShould emds_oith o
SemiColon bu t is opion al in 5aL 5esver

bLamquages oS@L
Duta Delinahon languoge CDDL)
Cocate
Altes
Sp-Remame
mCote
DaDP
Dota monupulaion language COML)
Tnsemt
UpDate
Delete

Dora 0uemyLanguoge LD2)


Select

iGOmsochon ontol lamguoge (TCL


Commit
RoLLbock
Sovepoint
(DCL)
Data ontol language
aant
ReNoke
0 DDL CData DeBnchion Longquage)

his Lomguoge Commamds are vsing to defne


odiy 4 Dodp on object
ot doBobase om
SaL Sesver

C.ocaBe- Cocating ane dotabosc orinem


table.in s0L Semves
Shep 1 i- Grcote a ne dotobase in SaL Senve
Symto i Cseote dotobase DBNAMED
Ccatedotobase MYDD

Step2 Select The zequied dotabase fom


SaL Se es
SymtoS- Use <DB Name
b Use YDB:

Step CacaBe nep toble. în databose


Synto 3-(eate toble <Toble Name
CKColummNamoD LOT Lsi20, LColumn
Name22
L0T> [Sizo] --- Jo0oJo06 ColumnS
Er -acote
Toble Sthudemt Csid nt
Snama ChoCio) Sfec
AGE Tinyint) DecimalL,2)

Step 4ToVie the Smuchune of fab.le


Sntax Sp_HELp LTOble Name,
Sp-HELp_ Shudemt
HELD 15 proccdefned 5Dooed Edu Poadune
ALTER To chonge o&
modityfhe Stushune
ofa table 08a datobaSe
using t h e Altes omm and e an peafvem
ollowing D operathons on ecistiA table.
T e pefiodm -these opervatiomSe ocquiaed
Sub Commamds of oltes..
i> Alte - Altes Column

i AHe Add
ii) Sp-Rename
iv) ALTER -Omp

Altes - Alte Column - To Chomge datatype


also Siz0 of the datatype of a pershCula Column-
ymta -
AlHe toble 4TN AHer Column < Column Name.
LNeo DI2 LNew Sizel

Ater toble Shudemt Alte Column SNamo


yocham C50)3-

ALte- Add:-Adding onec Column to add


xishng table COlumn
yTtas-ALtex dable LTN> App <Ne
Nama LDI2[Si2e1
ADD SAddaess
-ALle Table hd
NoKchar Co)_
olumnno
i ) Sp- Remone
T o change a nom
in_database
-0 atoblen ame.
Column Name in table :
A) 5yhtar to chonge. a
.iOLD Colur
m n NaNon
SP-Kemame. <TableName
KNeo ColummNam 2 -

E Sp-Remame Shhodemnt5Nama , Stuiden


NanaS

B Syntaou to change. o toble. namo. n dotabas


Habas
Sp Remoame. tCoid table Namo',KNeo tohle
Namez
Ei-Sp-Remomeshudemt', tShudemdetails
OR
Sp -Rename StuolemdeBoils,'studemt
N) ALTER-DaDp 3 DDpinga olumn mm.
the
tobla
Smtaz - ALtex table<Toble Nama>
Columm ColmnNames Drop
ALtem table Shudem Doop Column
AaE
mCate
DEeleting DLSfom Jha toble but
ot 5mucHUae o he table..
by USing_ mmate
Cmmamd e Can not delete a 5peifc 0
om
Dm the table because Hdosemt upport
the fable
Whee Clause Comdiion.

Symta buncote table (TableName. S


Tmcale fable Shudemt

doBabase
Dp Daopping 0 table fom o
peamamtl
Nama3
Sjntai= DaDp table LTable
Sudemt
D8 DaDp table

DiL (Data Momupulaton Lamguage


Used #O
This language CommcmdS ooe
database toble
dato în
Chomge a& manipulate. to a
=lnsercting a ne D in
17InSemt
methodso insest-
table
hee Oae i o
DLss mtD a table
Method Insehng cull
i> Tmplicit Columms intwa toble
(wHhou=

N o l u s forall
lyen
lt ac
ta ns-- Column)
m s e r t[ i n d t o < T o b l e A a m e alucS

valuo2, Voluls
-

Nolul,
Shidemt (sTID înts s n .
E -Coeate toble C6» 2), Age
ama
Nascha Cuo), Sfee decimal
inyint).

Inset+ intb Studemt NalueS Clol SAI


25o0,212
OR
ITnSes Shdem Volaes (loa JANES',
4500 23)

i ) plidt
Method 3 Inseaing Nalues
for aequioc.c Column's oml Uoith lefE any
-Cblumn in dhe toble

Tnset CJNTO] (TableNome> (Lequired


olumn NomaS NalueS Clo3 ALLEN').
Hot to oSet Mulple mDS nto a toble
5ynta fos implid+8--
Insent [INToJ {TableNama>
NaluoS CRo1
Voluas» CRow 2 JoleS)--9
Insesd mto Shudem+ VoluoS
(S00 222, Clo6 (loL4'Scot
H.omd', looo, 25)
5jntoxfor beplicit 3-
Tnsert [IHTOl/Tobledome
NamaS)ValueG CRequined olumn
CCkowiNaluesj, CRoLD2 Nalue.S
E Insers shudemE CSTID Nales Clo62, CLO32|
Clo8

Update Updating all 0 us data ina-


toble at a ime ot a Specifc 0 dcta
m a table by Using Whene' Comdihion.
SytaocS
Update <Table Name SeT 2 Columntame.12
<NalCa 1 LColumnName2 <vollue2
[Hheme ComdihiomJi-

ne a que o Update. employejab as


HR6alay a s 14,000 hos emploge
Numbe 15 7788
400o
UpDota emp Set Job : HR , Salca
Whet EmpNo 7788

al emploje
bi Wnte a quey ho Updae
Commiiom aS boO
S e t CoMM : Soo
Updote Emp

DeleBe -

Deleting all w IS m d h e -
i m a o r a Specifc D pom
Hable o t a
Clause Comdihon
Usingwhee
tha table by
[Hheaellonditon>Jj
4JableNama
Delele fom
deleBe enmployee
fmm
Bi ite a Queayt o
thetab]e. who a t wosking Jn the Job is
Cleoa
Jheae Jos cleok
Delele pvm Emp
t e a query to delete all empb
E
deBails om the fable
Delele fom EmpP
DiffeatnCe. behieeM delete dTmote
Delee mmCOte.
OTH is DML Pesotiom OT+ is DDL Opematiom

TCam deleBea SpedßcO +is not possible.


D Dm the toble

TSuppoxtHhere
clouse Comditon
3 + dosert Suppoa
Hhere clouse CondiboY
tis the temmpomay O is pemom-
data deletor
dato delehion
6 Lle Com
2rstone e on hotacstooe
deleted doto b-Using deleted dota by
DIback
golback USing
ce Cuhon Speae is
Slo CacuHon
fs+
Spead 1S-

You might also like