0% found this document useful (0 votes)
20 views3 pages

Alter Add

Sql related eveytribg

Uploaded by

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

Alter Add

Sql related eveytribg

Uploaded by

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

ALTER ADD,MODIFY,DELETE

ONLY FOR COLUMNS NOT FOR VALUES


Alter table student add unique(Sname);

Alter table student add foreign key (GUID) Reference Guadrian(Sname);

NEW COLUMN OR ATTRIBUTE


Alter table student add income int;

HERE TO MODIFY COLUMN NAME OR ATTRIBUTE


Alter table student modify GUID int(40)

SET DEFAULT VALUE ;


Alter table student modify Dateofbirth default 2020/13/02;

DELETER COLUMN;
Alter table student drop income

TO REMOVE FULL TABLE


Drop table student ;

FOR DATA MANUPULATION WITHIN


TABLE
Insert into student values(‘mantgan’,121,’21/2/31’,hello)

TO SHOW
Select * from manthunarang;
Select * from table-name from table-name where condition;
Star ke jagah column k name
Select Sname,Sbirth from student where rollno=2;
RETRIVE SELECTED COLUMN;
Select Sname from manthan;
AGAR 2 KRVANE H
Select SName,Srollno from manthan;
RENAMING OF COLUMN;
Use as
Select Sname as Name from manthan;
Here name and salary column name is changed and also displayed
Select Ename as Name,Salary*12 as Annual Salary from manthan;

DISTINCT CLAUSE;
Help in showing data without repeating
Select distinct DEAPID from student;

WHERE CLAUSE;
Condition specify
< > => <= can also be used
And and or are also used in where
All emplye earing more than 50000 and dept id is 004
Select * from student where income>5000 and Deptid = 004;
Display all empolye expect aliya , so not is used
Select * from student where not Sname = aliya;
Select * from student where Dept id = 001 or Dept id = 002 or Dept
id = 003

SHOW NAMES OF STARTING WITH K


Select * from student where Ename Like ‘k%’;

UPDATION IN RECORS
Update student set Dept = 001 where Rollno = 3

You might also like