SQL Tutorials


create database SQL; use SQL;



create table details( ID int, Names varchar(100), Age int, Country varchar(50), Birth int);



insert into details values(001,'Kamal',22,'Sri Lanka',1988); insert into details values(002,'Sadamali',21,'Sri Lanka',1989); insert into details values(003,'Gayan',12,'India',1950); insert into details values(004,'Rumesh',20,'Amarica',1990); insert into details values(005,'Rajika',21,'Canada',1988);



select * from details; select Names from details; select Names,Country from details;



select distinct Age from details;



select * from details where Country='Sri Lanka'; select * from details where Age=21; select * from details where Birth <1988; select * from details where Birth between 1988 and 1989; select * from details where Age =21 and Country='Canada'; select * from details where Age =12 or Country='Canada'; select * from details where Names like 'G%';



select * from details order by names desc; select * from details order by names asc;



update details set Birth ='1985' where ID ='4';



delete from details where ID='1';



truncate table details;



drop table details;



drop database SQL;


Comments


Post Comments

  • 4 comments