*SUB QUERY- *
select min(salary)from staff_details;
2ND MINIMUM-
*Not selecting minimum salary
*
select*from staff_details where salary not in (select min(salary)from staff_details);
*select minimum again to get 2nd minimum
*
select min(salary)from staff_details where salary not in( select min(salary)from staff_details);
*To get the row
*
select*from staff_details where salary=15000; OR
select*from staff_details where salary=( select min(salary)from staff_details where salary not in( select min(salary)from staff_details));
ORDER BY :
to list it as order ( ascending, descending)
select*from staff_details order by salary;
descending;
select*from staff_details order by salary desc;
*LIMIT (Limit the data)- HOW MANY VALUES ( ROW)
*
select*from staff_details order by salary desc limit 2;
*OFFSET- SKIP
*
SKIP THE ROW FROM THE LIST
select*from staff_details order by salary desc limit 2 offset 1;
*GROUP BY
*
It must have aggregate value.
select count(nationality) from staff_details group by nationality;
select nationality, count(nationality) from staff_details group by nationality;
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.