--1.
Write a sql query to fetch the rank of each and every
individual
--records based on name attribute from table employees
SELECT name,
RANK() OVER (ORDER BY name) AS rank
FROM employees1
--[Link] a sql query to fetch the Dense_rank of each and
every individual records
--based on Gender attribute from table employees
SELECT gender,
DENSE_RANK() OVER (ORDER BY gender) AS dense_rank
FROM employees1
--[Link] a sql query to fetch the Rownumber of each and
--every individual records based on id attribute from table
employees
SELECT id,
ROW_NUMBER() OVER (ORDER BY id) AS row_number
FROM employees1
--[Link] a sql query to fetch the rank of each and
--every individual records based on name attribute from table
employees and prtition the output by gender
SELECT name, gender,
RANK() OVER (PARTITION BY gender ORDER BY name) AS rank
FROM employees1
--[Link] a sql query to fetch the dense_rank of each and
--every individual records based on name attribute from table
employees and prtition the output by gender
SELECT name, gender,
DENSE_RANK() OVER (PARTITION BY gender ORDER BY name) AS rank
FROM employees1
--[Link] a sql query to fetch the Rownumber of each and every
--individual records based on id attribute from table
employees and partition the output by gender
SELECT id, gender,
ROW_NUMBER() OVER (PARTITION BY gender ORDER BY id) AS
row_number
FROM employees1
--[Link] a sql query to fetch the Rownumber of each and every
--individual records based on id attribute from table
employees and partition the output by name.
SELECT id, name,
ROW_NUMBER() OVER (PARTITION BY name ORDER BY id) AS
row_number
FROM employees1
--[Link] a sql query to fetch the total salary and display
--it beside each and every individual records based on salary
attribute in asc order from table employees
SELECT name,salary,
SUM(salary) OVER () AS total_salary
FROM employees1
ORDER BY salary ASC
--[Link] a sql query to fetch the name,gender,salary, total
salary
--and display the total_salary beside each and every
individual records based on salary attribute in asc order
from table employees and and partition the output by name.
SELECT name,gender,salary,
SUM(salary) OVER (PARTITION BY name) AS total_salary
FROM employees1
ORDER BY salary ASC
--[Link] a sql query to fetch the
name,gender,salary,last_value and display the First_value
--beside each and every individual records based on salary
attribute in asc order from table employees and and partition
the output by Gender..
SELECT name, gender, salary,
FIRST_VALUE(salary) OVER (PARTITION BY gender ORDER BY salary
ASC) AS first_value
FROM employees1
ORDER BY salary ASC
--[Link] a sql query to fetch the
name,gender,salary,last_value and display the
--last_value beside each and every individual records based on
salary attribute in asc order from table employees and and
partition the output by Gender..
SELECT name, gender, salary,
LAST_VALUE(salary) OVER (PARTITION BY gender ORDER BY
salary ASC
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
AS last_value
FROM employees1
ORDER BY salary ASC