--5. Like operator select * from employee where emp_name like 'a%' select * from employee where emp_name like '%m' select * from employee where emp_name like '%m%' select * from employee where emp_name not like '%m%'
Try this ; SELECT SUM(salary), name FROM table GROUP BY name ORDER BY name DESC OFFSET 2 LIMIT 1 ## This won't work if you have two individuals at the third rank, for that watch the second video of this playlist.
(select max(salary)from employee where salary(select max(salary)from employee); or SELECT name, salary FROM Employee e1 WHERE 3-1 = (SELECT COUNT(DISTINCT salary) FROM Employee e2 WHERE e2.salary > e1.salary)
Use dense_rank for these cases select * from (select name, salary, dense_rank() over (partition by name order by salary desc) rankID from emp) sub where sub.rankID = 3;
This entire playlist is soo amazing!
Thank you so much sir
Thanks for making this video
Very Nice
done
--5. Like operator
select * from employee where emp_name like 'a%'
select * from employee where emp_name like '%m'
select * from employee where emp_name like '%m%'
select * from employee where emp_name not like '%m%'
name salary
A 100
B 200
C 300
A 400
B 500
C 600
A 700
B 800
C 900
A 1000
B 1100
C 1200
Bro how to find the third highest salary group by name
Try this ;
SELECT SUM(salary), name
FROM table
GROUP BY name
ORDER BY name DESC
OFFSET 2
LIMIT 1
## This won't work if you have two individuals at the third rank, for that watch the second video of this playlist.
(select max(salary)from employee where salary(select max(salary)from employee);
or
SELECT name, salary FROM Employee e1 WHERE 3-1 = (SELECT COUNT(DISTINCT salary) FROM Employee e2 WHERE e2.salary > e1.salary)
SELECT SALARY FROM
(SELECT DISTINCT SALARY FROM TABLE ORDER BY SALARY DESC LIMIT 3) AS TB2
ORDER BY TB2.SALARY
LIMIT 1
Get the top 3 highest salery by group by name the get min from them.
Use dense_rank for these cases
select * from (select name, salary, dense_rank() over (partition by name order by salary desc) rankID from emp) sub where sub.rankID = 3;