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

SQL notes Part 1

Sql cs notes for class 12

Uploaded by

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

SQL notes Part 1

Sql cs notes for class 12

Uploaded by

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

Ajnnta,

DATE
PAGE

RDBMS SOl
DBMS i > (olleclion of inter- related_date ler ed

dogedher do Serve mulipleapplicahons.


Such as rekjeung adding dala in
medihjng
dalabase.

DBMS 1S Softw axe hat is eg2nsible

Stoing, máining (mintcin ing) and uhizing

RDBMS The dato is orgqvi2ed in tables (rows E (olun

These tables (alled aekations.

* Tuples - The tablks

* AHtihulesi- The colmns tables.

* Degre The total numbers cy QHaibuty Colums).


** Cardindlit, he tstal

se to uniquly idenify Qny rerosd


ow deto frorm dodle.

yPaimeny ky '- cnique and Can not be Nule (tMly)

2)Condidato e i More than one oHejbulls that (an

Seye 0sprimany tey.

9 AlHem att ty' A ky thad js not primany key is

Culed alernato ky.

) foxign ley - A non- ka atibte lwho valus


able
are dhjued foom

0ther
Ajanta
DATE
PAGE

* Sal So is a Stauctured
Queny danguage
that enables you to Create
Creete end opaal
RDBMS

DDL CDaa Definaien Language)

use to deline, Cre atl Modity and dete Hion

fable Dalabase.

a datg 6se i

Create dalas ase < daobase name ?)


Cxe ate databa se
clubj

the datybqsei

show databases
use a datasase

yse club club '- dalabasename

:
hee
D re ale ' To
dhree

Creote

Modily
tqpes

q
dable

dalle
DDL

Cieati
Common
/DD
Abernp
Add

modily
Lenae
dable
Lclang
)
(reale

Creale dable < table. nameitd 1 dalalpe Sge)


feild 2 datol type Sze
field 3 datoype (slge ))

4ield '- nome (alurgn s

dalutye '- Tupe y date


date (choacder
chasacder number dat )
Maxinum datu
Siye

Create Jable Club ( coach. 1d int (5)


uQrchar (20),
(oachname
SpottsName borchore (3o),

Date ofJaving dote

Pay

* To the sthuctore toble

DESC Clut
Dala tqpe ':
D Alphate '- Char,vGchar.
fto as,
-2) Numbersi- int,

double.
) Creale 3)date :- date
* others foomboot
Creale lable <dable n ame z
feild!
field

4ield '- nome rolum0s

dalutype'- Type date characler numser dat )


Siye
Max)mum

Create table Club (oach 1d int (5)


name
Coach barchar (20),
Spetsname borchor (3o2
Date of dote

'
Jorning

Pay

* To bitus the SAuclure toble

DESc Cub
Ajanta
DATE
PAGE

alu Com m on d is sed to madil Jable


its atttbules Column)

)To add a Column

AlHes table club oble nome


add class int (3)

nes oluMn name dalotype (sine)

2) To change nqme a Calumn

Ale table club

change Pay Salary int (lo)jnew doblySpe

old nome

3) Modity a
To Coluran (chonge daletype or sye)

AlHer dable club

Medlif Salary fload (20

(olumn name Atw dalu ype (sie

9 To To deleteldap a (olumn

Aley table club


Class
drop

(olornn name whh yau uont o dlelote


Ajanta
DATE
PAGE

5)TT chan geRename adle

AHex table club


Rename spots club i

3)Drsp i- Drap Commond is sed to clolet

Doop tosle spakts clus loslh nome

2)DM) (Daty Manipul ahion anguage

110)1))1 se do modity inset or celete ecotd in a tasle.

DTasext Conanaand

inses (ommangd is usedto in Serd ows / te(ordin

alhiady CTeded tasle.

Tnsed ino <tablename valus (valul, valu2--. Vakun);

Tnsend indo cluh valuen totbal, 2020(524S


(lol"karan" toothal",

valuls wll be guen


Ajantn
DATE

SElECT (onwond

Seloct coMMQnd used to redjve


data from afsplay
tasle.
ailfere nt
tways to 4se SELCCT (omond'
)T clisplay all ge cords fom tahle i

Seled foom club, Jabk narse

* alL (aive duphcate ualuyn es a ll)

9) Selcing puticulak Calumn Cs) -

Beleet Coach
Coach id,
id Cogchnameolumm$ noms whch
toom club we wan t csplau

3) Eiminating duplicat valus

Belet Distinct Spokds name


from clubj

9 Selechng specitic tows (hiven Conditons)


where clause)

Kelation speaators
uSing
Aonte,
DATE
PAGE

g.1 i- To cisplay Decord


foothall " (oach
Select coqch name fam club

where sAott naMe footbal!

2-
.
eg. 2 To
More
display

than
(oachid
yo,6o0
andpay whose Selory is

Selectcoach.id Coach nange

bom chub

where pay > 4O000

* Logical operafors (and, or not)


Uing

Cendhon bwith where)

Selet Coach_id, toach name


fom club

twhere ( Coach id = (02 88 oachid= 05)

> Solchng based on tage (usng belwtun, na belecen)

Seld Co ach naMe pay


fom clab

whee pay Belueen 20 000 qd 300o0:


Ajamto
DATE
PAGE

based en list Cusing TN and No7 I N)

Seleo trom club

whore spotd name IN ('footsal "basketsll r

belecd from club


where
Spok nane AOT TN Cootball 'basketball )
Based on paten matching Iike oper qdor
usiag 2 and

)_To list naMe f ooaches stat with '4l


Seleet * fom Club

where Coach namt LIkE "A."


2To ist amt f sposds end with '2

Slect spord. nam from clb


Club
where Spotts-name

3) To list name of coaches foyr


havin9 cheracders
har nQMe

Seect oach name club


(oach. naMe
Ajenta
DATE
PAGE

3)Updale COMMand - ysed to


update Lchange I macliy
3ecord in tasle

Update <tale- hame )


SET Column naMe
where < (ondiion >

Updote club
SET Spas.nome e 'korote 4

Giherecoach id = l05 )
4) Delete CoMMgnd - used to delelexecovd in a foble

) To delete cl! the ecovd

Dlte from club

a table
specific

Delie foom club


whee (oach id (03j

You might also like