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

SQL using MySQL

The document outlines various SQL database operations including creating, reading, updating, and deleting data. It provides examples of SQL commands such as CREATE TABLE, SELECT, and JOIN operations. Additionally, it describes data types and constraints like primary and foreign keys.

Uploaded by

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

SQL using MySQL

The document outlines various SQL database operations including creating, reading, updating, and deleting data. It provides examples of SQL commands such as CREATE TABLE, SELECT, and JOIN operations. Additionally, it describes data types and constraints like primary and foreign keys.

Uploaded by

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

Page No.

Date

Dala base

Data base CDB).


Retrievsl
DBMS DE
Usea
Dele tion

faabiensl (RDBAS)
pota stoved in Zables

Exam pes - mhoPb

Caeate
Read
Ublote
Delete
Date

SEQVEL stnetased

Database
Tabe 1 TAble 2
(Data Data

thetoara

Rol_w inenden
Rishi |01-1-2 M 443

Rohan XI 3-02-2eo M 466

col2 Col3
Page No.
Date

ot a table or dotabaje

CAEATE TAOLE ableame

sbena

jdN PRIMAY KEY,


ame YAhLMA RCso)

);
Date

PATA TYPE PESCRIPPION


CHAR CHAR Cso)

VARCHAR
BLoB BLoB (1ooo)

BiNT BIGWT

372, o36, y5,Z75, go7)


BIT B1Tl2)
FLoAT Pecimsl wumben - with precsion t 23 yi
DovBLE Decial DovgLE

BooLEAN BooL EAN

DATE DATE

YEAR YEAR

TUY]WT VNSI aNED (o to 255)


Date

pa (pta key Lonj ange:

->tabase seoled Qusyies

CREATE DATA ASE IE NoT EXISTS

DROP PA TABASE IEXI5TS dbnaye

SWow DATHBASES;

SHON THBIESS

Ldlesig» ef the btle


Page No.
Date

SELELr *ERoM abe

lsolnael, 6elame2)
VALVES VALVES
4o2
Loll-vi, sele-v1), C1o,"hesa, "2,

BEYS

abki-sdot

Peone
Mumhai
j03 Delli
3
here atabase
latabase
table
hen celaspbih
Bin
fable
than.
condioste
thay
i table eachtee
bave able
than
Date
PR)AR y HEy nahes

bedwen tobles

ta layNT DEEAVLT 25eeo


det value

Solet in etail
Use to

SELELTeli,le FRom bbee


ERoM ablehae
Page No.
Dale

WHERE Clanse

WAERE endr ions ;

BETNEEN ’ electy os

the

SELELT sll, ol2 FRen lh_bame


LiMT ben
Page No.
Date

ELEToll, ole Fhom tableA

SELEL T soax lsahs) nel a gm


MAY C)

AVac)

aRoUPBy cityi
Page No.
Date

aRovp By
HA YING 94x l93ks)>103

SELELT wloms)
FRon able-amé
WHERE on ditio
GRovp &Y elms
HAVING enitie
eRDER BY_lals) Asl;

WPDATE ablenane 0PDATE adet


Jrade
WHERE -nte ="A*
Page No.
Date

DELEE FRoM Zabeac DELETE FRo sy den


WHERE on lilios ; wHE BE

debt (oo lea hen CFK)

siece FK
Ada
|02 Bot |03
3

brtent 2
table table

oREI aN HEY (ebt) BEFE RENIESdept


selea) the
Gueries ated 7bee
cASCADE VPDATE
hSLADE DELETE ON
caseid) RENCES BEEELlose1D) KEY foREIGN
KEY, PRIRY
MA I id
dent TABLE CREATE
icNDE TEPDA gsinj key ovejn eJhen
LADE CASDELETE asinj Whang
texea
Hcstyonced
Date
No. Page
eu- tobeane
RENA NE To

ae
ALTER TABLE boble
M0DIFYseleame

JE
guNLA

dades table
Date

12

LNNER JolN
bo th tables

SELELTcolem 4) B

JNNER JOW table B

sludent cose

ada
bob
13 seie nce
Resll
conse
JNNER JOLN Govyse
bobaengll

Gouge
OUTER JON

LE FT olN

FRoM
LEFT TOLW tobe

adeo NUL L

3
Date

the and

SELELTslmns)
B

RIaHT JoN oble8

Result
SELELT
jo2 bob

03

jo7 áciene

FVLL JOLN

SEHET* FRoN saent as a

2EFF JON

ON a. id t. id:
Page No.
Date

ada
jo2 bob
sience

Comblen
Seiente

222

B
ON aid = b, id
WHERE

ada
computes
NeeL eid WHERE
asa set FROn SELELT
Betums
B ma
id
WHERE
Date
No. Page
Page No.
Date

SELELT aluoy S)

ada |03
bob lonald
|o3
103

adam doald 25

bob
a

jd
B
ets. alsofo, vaues TEDUPLI
GA ives Ga
ALL WNoN
tableB tableA
ableB FRor SELETeb
l) mn
B ablA
e ERoM kelan
4) SELELT
donal
bob
adars
Date
No. Page
Querj
- n e l i e s 2 5ELELTsoements
withianetten saL Quev)
HFRE
SELELT o n ) Queg
ERoM fable hame
WHERE snlenane Amon

*sEECT
FRoM
WHERE

FRoM e,cebns)
ERoM
Page No
Date

table

SELELT co lemn3) FRon ate ;

SELEL * FRoM vicli

time

You might also like