Sa
* SQL stards for Structured Quesy Langucge -
x Ser isa Standard language for Storing , Trenipulaking
and ~vetrteving data th databases .
% S@L commands are classified into five types: They me
1. DDL commands
» DML Commands
2
3. DCL Commands
4. TCL commands
Ss
- DEL commands
DDL — Data Definition Languoge
DML > Data Mamipuiakion Larnguege
BcL + Pata Control Languoge
Tel ~~ Transaction Contret Language .
DEL ~
Data Quesy Language -
SQL commants
qt 1
oot | DML \ bei [ tex |
eC ea Grant Lcormit | scteck
Drop L_ deiele Revoie | t— Rolikack
Arter jake.
_ upd L_ savopeint
ArucraléTable :- A table is an arrangement of dato tn tre forrn
Of FNS ard colUMNS -
CREATING A TABLE
The syntax for creattrg a toble
CREATE TABLE Z2TABLENAMGE >
¢
ZCOLUMN-I> DATATYPE ,
DATATYPE,
< COLUMN -N> DATATYPE
4
Eg. CREATE TABLE Student
¢
Rotino Number,
Name Vaerchar>(20),
Marks Number
d .
REcoRD INTo TABLE
TNISERTING A
The Syntax for inserting a record to @ bake is
ZTABLENAMED VALUES ( VALUE-I, VAVE-2
INSERT INTO
-- .VAWE-N ) :
2
Eg: INSERT INTO Student values( tool, ‘Suresh! +5);
; ?TNSERT .
TNSERT INTO Student values ( XRollno, ‘Zrniame' ,
RMark5).
This Command is used to take tmpuk from the
Keyboard and Store tt tn a table.
UPDATING A RECORD IN A TABLE
The Syntax for updating o wetord in a babe is
UPDATE ZTABLENAMES SET = VALUE
E-g. Updote Student get Marks =80 Where Rolin > Ico! *
DELETING A RECORD FROM A TABLE
The Syntax for deleting 2 xecord from a EAbe 8.
NAME> WHERE
DELETE FROM
;
Eg- Select * from student 5
RETRIEVING A Specific RECORD FROM A TABLE
The Syntax fer vebrfeveng a Specttrc record cnatabie
ts
SELECT & FROM ZTABLENAME> WHERE
DATATYPE *
>
Eg: ALTER TABLE Student ADD addrass Voomher2{20):DROPPING A CoLuMN FROM A TABLE
The Syntax for drepping a colump from a toe &
ALTER TABLE DROP COLUMN! ZCOLUMNNAME S
e ATER TABLE Stuclent DROP COLUMN addryoss «
—_— >
MODIFYING THE SIZE OF A COLUMN IN A TABLE
The Syntax for rmodifying Ene Size of acelumMD in
table is
ALTER TABLE 2TABLENAME> MODIFY K£COLUMNNAME D>
pataype (NEW SIZE),
E-g. ALTER TABLE Student mopiFy addvess Verehara(ho)
ADDING A PRIMARY KEY
Syntax
ALTER TABLE IRBLENAME> ADD CONSTRAINT ZCONSTRAINT
NAME>
PRIMARY KEY (COLUMN NAME);
eg:
ALTER TABLE Stuclent APD CONSTRAINT pK _stuclent
Prieray Key ¢ Rollo’) 5
DROPPING A PRIMARY KEY
2 Ez = —_
Syntax
Name> DROP PRIMARY EEY;-
ALTER TABLE 4TABLE
ey
oF a
Aree TABLE student DROP PRIMARY KEY 5DROPPING A TABLE
_———
The syntax for dropping a table iS
DRoP TARE