The document contains SQL queries that create a database table called "people" with columns for roll number, name, address, and age. It then inserts records into the table and performs various SELECT queries to retrieve, filter, sort, aggregate, and update the data in the table.
The document contains SQL queries that create a database table called "people" with columns for roll number, name, address, and age. It then inserts records into the table and performs various SELECT queries to retrieve, filter, sort, aggregate, and update the data in the table.
The document contains SQL queries that create a database table called "people" with columns for roll number, name, address, and age. It then inserts records into the table and performs various SELECT queries to retrieve, filter, sort, aggregate, and update the data in the table.
insert into people(roll_no,name,address,age) values(101,'Balaji','Salem',34);
insert into people(roll_no,name,address,age) values(102,'Rithik','Salem',3); insert into people(roll_no,name,address,age) values(103,'Vanitha','Thanjavur',25); insert into people(roll_no,name,address,age) values(104,'Madhu','Chennai',64); insert into people(roll_no,name,address,age) values(105,'parimala','trichy',52); select name from people where age=3; select name from people where age<>3; select * from people where age between 3 and 35; select name from people where address like 's%'; select * from people where address in ('salem','trichy');
select * from people where age >1 and address='salem';
select name from people where age >50 or address='salem'; select age from people where NOT address='salem'; select * from people where address='salem' and not (age>25);
select * from people order by address;
select * from people order by address desc;
select * from people order by address ASC,age ASC;
insert into people(roll_no,name) values(106,'rock'); select * from people; select * from people where address is null;
select * from people where age is not null;
update people set name='prasath',age=35 where roll_no=101; update people set name='prasath' where address='salem'; update people set name='prasath';(without where condition, its false) delete from people where name='balaji'; delete from people;(without where condition, it deletes all the rows/records) select * from people limit 3; select * from people where address='salem' limit 1; select min(age) from people; select max(age) from people; select count(age) from people; select avg(age) from people; select sum(age) from people;
select * from people where name like '%a';
select * from people where name like ‘R%’; select * from people where name like '%th%'; select * from people where name like '_a%'; select * from people where name like 'm_%'; select * from people where name like 'm__%'; select * from people where name like 'p%a'; select * from people where name not like 'b%';
select * from people where name like 'van%';
select * from people where name like '%la%'; select * from people where name like '_alaji'; select * from people where name like 'R_th_k'; select * from people where name like '[a-p]%';