Professional Documents
Culture Documents
Siddardha - 03 09 2018.sql
Siddardha - 03 09 2018.sql
4.If there are two tables emp1 and emp2, and both have common record. How can I
fetch all the
records but common records only once
ans : by using union we can achieve
select * from emp1 union select * from emp2;
5.Write an SQL Query to check whether date passed to Query is in the specified
format
6.For any given date, get the Last Date of: Previous Month & Current Month & Next
Month
ans: rank gives you the ranking within your ordered partition mentioned in 'rank()
over(partioned by m_id) rank_mid' and same values are assigned the same rank with
eliminating next sequent ranks while
dense rank again gives you the ranking within your ordered partition, but the
ranks are consecutive without skipping any values
9.Write a SQL query to maximum salary from a table without using MAX or MIN
aggregate functions
Salar
7500
7525
7550
7600
757
ans : select * from emp order by desc limit 1;