SQL 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

1/13/22, 6:18 AM Preeti Sondhi on LinkedIn: #interviewquestions #interviewpreparation #dataanalystjobs

Join now Sign in

Preeti Sondhi

Preeti Sondhi
Data Analyst @JLL | YouTuber @youtube.com/c/PreetiSondhi
7mo

Day 13 | SQL Interview Questions for Data Analyst/ Data Scientist/ Business Analyst

1) Who is getting the highest salary from employee table?

2) Find the second highest salary from Table.

3) If date of birth is given in the table. Find the highest salary whose age is between 30 to 50 yrs. 

4)  Write SQL Query to find the number of employees according to department whose DOB is between
01/01/1992 to 31/12/1994.

If anyone is interested for similar content, Do checkout my YouTube channel.

𝑰𝒇 𝒚𝒐𝒖 𝒉𝒂𝒗𝒆𝒏'𝒕 𝒔𝒖𝒃𝒔𝒄𝒓𝒊𝒃𝒆𝒅 𝒎𝒚 𝒄𝒉𝒂𝒏𝒏𝒆𝒍 𝒚𝒆𝒕, 𝒅𝒐 𝒔𝒖𝒃𝒔𝒄𝒓𝒊𝒃𝒆!!

𝑳𝒊𝒏𝒌 𝒕𝒐 𝒎𝒚 𝒄𝒉𝒂𝒏𝒏𝒆𝒍 𝒘𝒊𝒍𝒍 𝒃𝒆 𝒇𝒐𝒖𝒏𝒅 𝒂𝒔 𝒑𝒂𝒓𝒕 𝒐𝒇 𝒕𝒉𝒆 𝒇𝒊𝒓𝒔𝒕 𝒄𝒐𝒎𝒎𝒆𝒏𝒕.

#interviewquestions #interviewpreparation #dataanalystjobs #SQL #datascience #businessanalyst #tab
leaudeveloper #Dataengineers

93 ·
9 Comments

Like Comment Share

Preeti Sondhi

7mo
Link to my channel: https://youtube.com/c/PreetiSondhi

Answer Video Link: https://youtu.be/nV0WVZ8JoHc

Like
Reply

Mohd Reeyaz

7mo
you can post the document in word as well youtube is fine

https://www.linkedin.com/feed/update/urn:li:activity:6812691515576582144/ 1/3
1/13/22, 6:18 AM Preeti Sondhi on LinkedIn: #interviewquestions #interviewpreparation #dataanalystjobs

Like
Reply
1 Like

Debashis Sahu

7mo
1. select name,salary from Employee

   where salary in (select max(salary) from Employee);

2. SELECT name, MAX(salary) as salary from employee

   where salary < (select MAX(salary) from employee);

3. Select max(salary) from Employee

   where datediff(year,'DOB',getdate())between 30 and 50;

4.select count(employee_id),department from Employee

 where DOB between '01/01/1992' and '31/12/1994'

  order by department;

Like
Reply
8 Likes

Bhargav Sai Polavarapu

7mo
1)select * from employee where salary =

(select max(salary) from employee );

2)with using top

select max(salary) from salary where salary in

(select top 2 salary from employee);

without using top/limit

select A.salary from(

select e.salary , rank() over(order by e.salary desc) salaryrank from employee e) A 

where A.salaryrank*2=(select 2*2) ;

3)select max(e.salary) from employee e where datediff(yy,e.dob,GETDATE()) between 30


and 50 ;

4)select e.departement,count(*) from employee e where e.dob between 01011992 and


31121994

group by e.departement.

Like
Reply
4 Likes
See more comments

To view or add a comment, sign in

https://www.linkedin.com/feed/update/urn:li:activity:6812691515576582144/ 2/3
1/13/22, 6:18 AM Preeti Sondhi on LinkedIn: #interviewquestions #interviewpreparation #dataanalystjobs

5,014 followers

63 Posts
· 0 Articles

View Profile

Follow

© 2022 About

Accessibility User Agreement

Privacy Policy Cookie Policy

Copyright Policy Brand Policy

Guest Controls Community Guidelines

Language

https://www.linkedin.com/feed/update/urn:li:activity:6812691515576582144/ 3/3

You might also like