SQL INTERVIEW QUESTION | Calculate 90th discrete percentile of each department

DROP TABLE IF EXISTS salaries


 -- Create the salaries table

CREATE TABLE salaries (

    employee_id INT,

    department VARCHAR(1),

    salary INT

);


-- Insert data into the salaries table

INSERT INTO salaries (employee_id, department, salary) VALUES

(1, 'A', 3000),

(2, 'A', 5000),

(3, 'A', 7000),

(4, 'B', 2000),

(5, 'B', 4000),

(6, 'B', 6000),

(7, 'C', 1000),

(8, 'C', 3000),

(9, 'C', 5000);

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