----CREATE DATABASE---------------------------------------
create database SQL;
use SQL;
----CREATE TABLE-------------------------------------------
create table details(
ID int,
Names varchar(100),
Age int,
Country varchar(50),
Birth int);
---INSERT INTO records-------------------------------------
insert into details values(001,'Kamal',22,'Sri Lanka',1988);
insert into details values(002,'Sadanali',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);
-----show table--------------------------------------------
select * from details;
select Names from details;
select Names,Country from details;
--use distinct clause-----(don't repeat)----
select distinct Age from details;
--use of the WHER clouse----
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%';
-----use of ORDER BY clause----------
select * from details order by names desc;
select * from details order by names asc;
----use UPDATE clause---------
update details set Birth ='1985' where ID ='4';
---use DELETE a records from table----------------
delete from details where ID='1';
----use of TRUNCATE to delete records---(delete all valuse)-
truncate table details;
--delete table-------
drop table details;
---delete database-----
drop database SQL;