Department top 3 salaries | SQL Interview question

 DML Script:


DROP TABLE IF EXISTS Employee

DROP TABLE IF EXISTS Department


Create table  Employee (id int, name varchar(255), salary int, departmentId int)

Create table Department (id int, name varchar(255))

 

insert into Employee (id, name, salary, departmentId) values ('1', 'Joe', '85000', '1')

insert into Employee (id, name, salary, departmentId) values ('2', 'Henry', '80000', '2')

insert into Employee (id, name, salary, departmentId) values ('3', 'Sam', '60000', '2')

insert into Employee (id, name, salary, departmentId) values ('4', 'Max', '90000', '1')

insert into Employee (id, name, salary, departmentId) values ('5', 'Janet', '69000', '1')

insert into Employee (id, name, salary, departmentId) values ('6', 'Randy', '85000', '1')

insert into Employee (id, name, salary, departmentId) values ('7', 'Will', '70000', '1')

 

insert into Department (id, name) values ('1', 'IT')

insert into Department (id, name) values ('2', 'Sales')



SELECT * FROM Employee

SELECT * FROM Department


For detailed explanation: https://youtu.be/-7oCETHaFqk

Comments

Popular posts from this blog

50 Essential SQL Questions to Land Your Dream Job

How to find all the customers who placed orders on three consecutive days | SQL Scenario questions

ACCENTURE SQL INTERVIEW QUESTION | Change the ProductIDs