Professional Documents
Culture Documents
-- update
update student set address='chennai'; -- update address value for all rows
-- update address value for rows where stud_name starts with N
update student set address='hbad' where stud_name like 'n%';
-- delete
delete from student;
delete from student where roll_no=100; -- deletes the specific row
truncate table student; -- delets the entire data
-- sort the data first on the basis of dept and then its salaries
select * from emp order by salary,dept_name;
select * from emp order by dept_name,salary;
-- distinct
select distinct salary from emp order by salary desc limit 8,1;
-- group by :
-- having
/*
emp : table
empid,empname,salary,loc -- columns
1001 rahul 70000 pune -- rows/records
*/
-- having :
select `lead star`,avg(revenue)
from movies
where genre='action'
and `whether remake`='yes'
group by `lead star`
having avg(revenue)>500000000;