- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindowfunc1.sql
More file actions
Latest commit
24 lines (14 loc) · 622 Bytes
/
Copy pathwindowfunc1.sql
File metadata and controls
24 lines (14 loc) · 622 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- Window Functions in SQL
-- 1. row_number()
use b76;
select*from movies;
select title, year, row_number() over() as row_num
from movies;
use b88;
select*from wind;
select*, row_number() over() as row_num from wind;
select*, row_number() over(partition by Dept) as row_num from wind;
select*, row_number() over(partition by Dept order by salary desc) as row_num from wind;
select*, row_number() over(partition by Designation order by salary desc) as row_num from wind;
select*, rank() over(partition by dept order by salary desc) as rank_num from wind;
-- Tuesday will be Last Session - 07:00 P.M -