<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by S md Ayesha on Medium]]></title>
        <description><![CDATA[Stories by S md Ayesha on Medium]]></description>
        <link>https://medium.com/@smdayesha94?source=rss-1ff691320f7f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GlHr3CwyiEhU7tsG</url>
            <title>Stories by S md Ayesha on Medium</title>
            <link>https://medium.com/@smdayesha94?source=rss-1ff691320f7f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:28:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@smdayesha94/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Top SQL Interview Questions on Employee and Department Tables]]></title>
            <link>https://blog.dataengineerthings.org/top-sql-interview-questions-on-employee-and-department-tables-d32d5ae57845?source=rss-1ff691320f7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d32d5ae57845</guid>
            <category><![CDATA[most-asked-question]]></category>
            <category><![CDATA[microsoft-sql-server]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[sql-interview-questions]]></category>
            <category><![CDATA[sql-server]]></category>
            <dc:creator><![CDATA[S md Ayesha]]></dc:creator>
            <pubDate>Mon, 13 Oct 2025 14:15:42 GMT</pubDate>
            <atom:updated>2025-12-30T16:49:13.246Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Go9Bxhvd_slCQs-L" /><figcaption>Photo by <a href="https://unsplash.com/@wocintechchat?utm_source=medium&amp;utm_medium=referral">Christina @ wocintechchat.com</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this comprehensive post, I have compiled all possible questions that could be asked in regular interviews on Employee and Department tables, along with the source data for your practice.</p><p>Additionally, I have crafted these questions with a data set for PySpark, which you can find in my blog post below.</p><p><a href="https://www.fabricofdata.com/2025/06/pyspark-employee-department-queries.html">Top PySpark Interview Questions on Employee and Department Datasets (with Examples)</a></p><h3>Input Data</h3><h4>Source Table Script:</h4><pre>--Department Table<br>CREATE TABLE Department (<br>    DepartmentID INT PRIMARY KEY,<br>    DepartmentName VARCHAR(50) NOT NULL,<br>    Location VARCHAR(50)<br>);<br><br>--Employee Table<br>CREATE TABLE Employee (<br>    EmployeeID INT PRIMARY KEY,<br>    FirstName VARCHAR(50),<br>    LastName VARCHAR(50),<br>    DepartmentID INT NULL,<br>    ManagerID INT NULL,<br>    JobTitle VARCHAR(50),<br>    Salary DECIMAL(10,2),<br>    HireDate DATE,<br>    BirthDate DATE,<br>    Email VARCHAR(100),<br>    Bonus DECIMAL(10,2) NULL,<br>    RemoteWork BIT DEFAULT 0,<br>    CONSTRAINT FK_Employee_Department FOREIGN KEY (DepartmentID) REFERENCES Department(DepartmentID),<br>    CONSTRAINT FK_Employee_Manager FOREIGN KEY (ManagerID) REFERENCES Employee(EmployeeID)<br>);<br><br>--Employee History Table<br>CREATE TABLE EmployeeHistory (<br>    HistoryID INT PRIMARY KEY IDENTITY(1,1),<br>    EmployeeID INT NOT NULL,<br>    DepartmentID INT,<br>    JobTitle VARCHAR(50),<br>    Salary DECIMAL(10,2),<br>    StartDate DATE NOT NULL,<br>    EndDate DATE NULL,  -- NULL means current<br>    CONSTRAINT FK_History_Employee FOREIGN KEY (EmployeeID) REFERENCES Employee(EmployeeID),<br>    CONSTRAINT FK_History_Department FOREIGN KEY (DepartmentID) REFERENCES Department(DepartmentID)<br>);</pre><h4>Data Insert Statements</h4><pre>-- Insert Departments<br>INSERT INTO Department (DepartmentID, DepartmentName, Location) VALUES<br>(1, &#39;Sales&#39;, &#39;New York&#39;),<br>(2, &#39;Engineering&#39;, &#39;San Francisco&#39;),<br>(3, &#39;HR&#39;, &#39;Chicago&#39;),<br>(4, &#39;Finance&#39;, &#39;Boston&#39;);<br><br>--Insert Empo=loyee Table<br>INSERT INTO Employee (EmployeeID, FirstName, LastName, DepartmentID, ManagerID, JobTitle, Salary, HireDate, BirthDate, Email, Bonus, RemoteWork) VALUES<br>(101, &#39;Alice&#39;, &#39;Anderson&#39;, 1, NULL, &#39;Sales Manager&#39;, 90000, &#39;2015-03-10&#39;, &#39;1980-05-12&#39;, &#39;alice.anderson@example.com&#39;, 5000, 0),<br>(102, &#39;Bob&#39;, &#39;Brown&#39;, 1, 101, &#39;Sales Executive&#39;, 60000, &#39;2018-06-21&#39;, &#39;1990-11-22&#39;, &#39;bob.brown@example.com&#39;, 2000, 0),<br>(103, &#39;Carol&#39;, &#39;Clark&#39;, 1, 101, &#39;Sales Executive&#39;, 62000, &#39;2020-01-15&#39;, &#39;1992-07-15&#39;, &#39;carol.clark@example.com&#39;, 2500, 1),<br>(104, &#39;David&#39;, &#39;Davis&#39;, 1, 102, &#39;Sales Executive&#39;, 58000, &#39;2019-09-01&#39;, &#39;1988-08-08&#39;, &#39;david.davis@example.com&#39;, 2200, 0),<br>(105, &#39;Eva&#39;, &#39;Evans&#39;, 1, 102, &#39;Sales Executive&#39;, 61000, &#39;2017-04-11&#39;, &#39;1991-02-27&#39;, &#39;eva.evans@example.com&#39;, 2100, 1),<br>(106, &#39;Frank&#39;, &#39;Foster&#39;, 1, 103, &#39;Sales Associate&#39;, 45000, &#39;2022-02-10&#39;, &#39;1995-12-20&#39;, &#39;frank.foster@example.com&#39;, NULL, 1),<br>(107, &#39;Grace&#39;, &#39;Green&#39;, 1, 103, &#39;Sales Associate&#39;, 46000, &#39;2023-01-05&#39;, &#39;1994-06-13&#39;, &#39;grace.green@example.com&#39;, NULL, 0),<br>(108, &#39;Henry&#39;, &#39;Hill&#39;, 1, 104, &#39;Sales Associate&#39;, 47000, &#39;2021-11-23&#39;, &#39;1996-03-30&#39;, &#39;henry.hill@example.com&#39;, NULL, 1),<br>(109, &#39;Ivy&#39;, &#39;Ingram&#39;, 1, 105, &#39;Sales Associate&#39;, 48000, &#39;2020-12-15&#39;, &#39;1993-09-10&#39;, &#39;ivy.ingram@example.com&#39;, NULL, 0),<br>(110, &#39;Jack&#39;, &#39;Jones&#39;, 1, 105, &#39;Sales Associate&#39;, 44000, &#39;2016-08-29&#39;, &#39;1987-01-07&#39;, &#39;jack.jones@example.com&#39;, NULL, 0),<br>(201, &#39;Kevin&#39;, &#39;King&#39;, 2, NULL, &#39;Engineering Manager&#39;, 110000, &#39;2014-07-10&#39;, &#39;1978-12-05&#39;, &#39;kevin.king@example.com&#39;, 7000, 0),<br>(202, &#39;Laura&#39;, &#39;Lee&#39;, 2, 201, &#39;Software Engineer&#39;, 85000, &#39;2019-08-19&#39;, &#39;1991-04-17&#39;, &#39;laura.lee@example.com&#39;, 3000, 1),<br>(203, &#39;Mike&#39;, &#39;Morris&#39;, 2, 201, &#39;Software Engineer&#39;, 87000, &#39;2020-10-05&#39;, &#39;1990-10-25&#39;, &#39;mike.morris@example.com&#39;, 3200, 0),<br>(204, &#39;Nina&#39;, &#39;Nelson&#39;, 2, 202, &#39;Software Engineer&#39;, 83000, &#39;2018-03-12&#39;, &#39;1992-01-30&#39;, &#39;nina.nelson@example.com&#39;, 2900, 0),<br>(205, &#39;Oscar&#39;, &#39;Owens&#39;, 2, 202, &#39;QA Engineer&#39;, 70000, &#39;2021-01-18&#39;, &#39;1993-07-02&#39;, &#39;oscar.owens@example.com&#39;, 1800, 1),<br>(206, &#39;Pam&#39;, &#39;Peters&#39;, 2, 203, &#39;QA Engineer&#39;, 71000, &#39;2022-06-20&#39;, &#39;1994-11-15&#39;, &#39;pam.peters@example.com&#39;, 1900, 1),<br>(207, &#39;Quinn&#39;, &#39;Quincy&#39;, 2, 203, &#39;DevOps Engineer&#39;, 75000, &#39;2017-09-01&#39;, &#39;1989-05-23&#39;, &#39;quinn.quincy@example.com&#39;, 2500, 0),<br>(208, &#39;Rachel&#39;, &#39;Reed&#39;, 2, 204, &#39;DevOps Engineer&#39;, 74000, &#39;2016-12-30&#39;, &#39;1988-08-11&#39;, &#39;rachel.reed@example.com&#39;, 2400, 0),<br>(209, &#39;Steve&#39;, &#39;Smith&#39;, 2, 205, &#39;Software Engineer&#39;, 86000, &#39;2019-11-14&#39;, &#39;1991-02-19&#39;, &#39;steve.smith@example.com&#39;, 3100, 1),<br>(210, &#39;Tina&#39;, &#39;Turner&#39;, 2, 205, &#39;Software Engineer&#39;, 88000, &#39;2023-03-03&#39;, &#39;1995-06-22&#39;, &#39;tina.turner@example.com&#39;, 3300, 0),<br>(301, &#39;Uma&#39;, &#39;Underwood&#39;, 3, NULL, &#39;HR Manager&#39;, 80000, &#39;2013-05-07&#39;, &#39;1977-07-14&#39;, &#39;uma.underwood@example.com&#39;, 4500, 0),<br>(302, &#39;Victor&#39;, &#39;Vance&#39;, 3, 301, &#39;HR Executive&#39;, 55000, &#39;2019-07-12&#39;, &#39;1990-01-20&#39;, &#39;victor.vance@example.com&#39;, NULL, 0),<br>(303, &#39;Wendy&#39;, &#39;Williams&#39;, 3, 301, &#39;HR Executive&#39;, 56000, &#39;2020-08-25&#39;, &#39;1992-03-16&#39;, &#39;wendy.williams@example.com&#39;, NULL, 0),<br>(304, &#39;Xander&#39;, &#39;Xiong&#39;, 3, 302, &#39;Recruiter&#39;, 52000, &#39;2021-04-19&#39;, &#39;1993-09-12&#39;, &#39;xander.xiong@example.com&#39;, NULL, 1),<br>(305, &#39;Yara&#39;, &#39;Young&#39;, 3, 303, &#39;Recruiter&#39;, 53000, &#39;2022-09-30&#39;, &#39;1994-12-24&#39;, &#39;yara.young@example.com&#39;, NULL, 0),<br>(306, &#39;Zane&#39;, &#39;Zimmerman&#39;, 3, 304, &#39;HR Associate&#39;, 48000, &#39;2017-01-15&#39;, &#39;1988-11-05&#39;, &#39;zane.zimmerman@example.com&#39;, NULL, 1),<br>(307, &#39;Anna&#39;, &#39;Adams&#39;, 3, 304, &#39;HR Associate&#39;, 47000, &#39;2018-03-11&#39;, &#39;1990-06-28&#39;, &#39;anna.adams@example.com&#39;, NULL, 0),<br>(308, &#39;Ben&#39;, &#39;Baker&#39;, 3, 305, &#39;HR Associate&#39;, 46000, &#39;2019-05-05&#39;, &#39;1991-08-19&#39;, &#39;ben.baker@example.com&#39;, NULL, 1),<br>(309, &#39;Cathy&#39;, &#39;Cole&#39;, 3, 305, &#39;HR Executive&#39;, 54000, &#39;2016-11-17&#39;, &#39;1987-10-03&#39;, &#39;cathy.cole@example.com&#39;, NULL, 0),<br>(310, &#39;Dan&#39;, &#39;Duke&#39;, 3, 306, &#39;Recruiter&#39;, 51000, &#39;2023-02-28&#39;, &#39;1995-07-30&#39;, &#39;dan.duke@example.com&#39;, NULL, 1),<br>(401, &#39;Ellen&#39;, &#39;Evans&#39;, 4, NULL, &#39;Finance Manager&#39;, 95000, &#39;2012-10-21&#39;, &#39;1979-04-22&#39;, &#39;ellen.evans@example.com&#39;, 6000, 0),<br>(402, &#39;Fred&#39;, &#39;Fisher&#39;, 4, 401, &#39;Accountant&#39;, 65000, &#39;2018-12-01&#39;, &#39;1989-09-10&#39;, &#39;fred.fisher@example.com&#39;, 2200, 1),<br>(403, &#39;Gina&#39;, &#39;Garcia&#39;, 4, 401, &#39;Accountant&#39;, 66000, &#39;2019-01-10&#39;, &#39;1990-05-25&#39;, &#39;gina.garcia@example.com&#39;, 2300, 0),<br>(404, &#39;Harry&#39;, &#39;Hughes&#39;, 4, 402, &#39;Financial Analyst&#39;, 70000, &#39;2020-06-15&#39;, &#39;1991-11-30&#39;, &#39;harry.hughes@example.com&#39;, 2600, 1),<br>(405, &#39;Isabel&#39;, &#39;Ives&#39;, 4, 402, &#39;Financial Analyst&#39;, 71000, &#39;2021-09-22&#39;, &#39;1992-02-14&#39;, &#39;isabel.ives@example.com&#39;, 2700, 0),<br>(406, &#39;John&#39;, &#39;Jones&#39;, 4, 403, &#39;Accountant&#39;, 64000, &#39;2017-07-19&#39;, &#39;1988-07-07&#39;, &#39;john.jones@example.com&#39;, 2100, 0),<br>(407, &#39;Karen&#39;, &#39;King&#39;, 4, 403, &#39;Accountant&#39;, 63000, &#39;2016-05-27&#39;, &#39;1987-03-29&#39;, &#39;karen.king@example.com&#39;, 2000, 1),<br>(408, &#39;Larry&#39;, &#39;Long&#39;, 4, 404, &#39;Financial Analyst&#39;, 72000, &#39;2015-08-09&#39;, &#39;1986-12-18&#39;, &#39;larry.long@example.com&#39;, 2800, 0),<br>(409, &#39;Mona&#39;, &#39;Moore&#39;, 4, 404, &#39;Accountant&#39;, 65000, &#39;2022-11-11&#39;, &#39;1993-10-02&#39;, &#39;mona.moore@example.com&#39;, 2300, 0),<br>(410, &#39;Nate&#39;, &#39;Norris&#39;, 4, 405, &#39;Accountant&#39;, 64000, &#39;2023-04-01&#39;, &#39;1994-01-15&#39;, &#39;nate.norris@example.com&#39;, 2200, 1);<br><br>--Insert Employee History Table<br>INSERT INTO EmployeeHistory (EmployeeID, DepartmentID, JobTitle, Salary, StartDate, EndDate) VALUES<br>(101, 1, &#39;Sales Associate&#39;, 85000, &#39;2015-03-10&#39;, &#39;2018-12-31&#39;),<br>(101, 1, &#39;Sales Manager&#39;, 90000, &#39;2019-01-01&#39;, NULL),<br>(102, 1, &#39;Sales Executive&#39;, 55000, &#39;2018-06-21&#39;, &#39;2020-12-31&#39;),<br>(102, 1, &#39;Sales Executive&#39;, 60000, &#39;2021-01-01&#39;, NULL),<br>(103, 2, &#39;Software Engineer&#39;, 70000, &#39;2018-03-01&#39;, &#39;2019-12-31&#39;),<br>(103, 1, &#39;Sales Executive&#39;, 62000, &#39;2020-01-01&#39;, NULL),<br>(104, 1, &#39;Sales Executive&#39;, 57000, &#39;2019-09-01&#39;, &#39;2021-06-30&#39;),<br>(104, 1, &#39;Sales Executive&#39;, 58000, &#39;2021-07-01&#39;, NULL),<br>(105, 1, &#39;Sales Executive&#39;, 60000, &#39;2017-04-11&#39;, &#39;2019-12-31&#39;),<br>(105, 1, &#39;Sales Executive&#39;, 61000, &#39;2020-01-01&#39;, NULL),<br>(106, 1, &#39;Sales Associate&#39;, 45000, &#39;2022-02-10&#39;, NULL),<br>(107, 1, &#39;Sales Associate&#39;, 45500, &#39;2023-01-05&#39;, NULL),<br>(108, 1, &#39;Sales Associate&#39;, 46000, &#39;2021-11-23&#39;, NULL),<br>(109, 1, &#39;Sales Associate&#39;, 47000, &#39;2020-12-15&#39;, NULL),<br>(110, 1, &#39;Sales Associate&#39;, 44000, &#39;2016-08-29&#39;, NULL);<br>INSERT INTO EmployeeHistory (EmployeeID, DepartmentID, JobTitle, Salary, StartDate, EndDate) VALUES<br>(201, 2, &#39;Junior Engineer&#39;, 90000, &#39;2014-07-10&#39;, &#39;2016-12-31&#39;),<br>(201, 2, &#39;Engineering Manager&#39;, 110000, &#39;2017-01-01&#39;, NULL),<br>(202, 2, &#39;Junior Engineer&#39;, 70000, &#39;2019-08-19&#39;, &#39;2021-12-31&#39;),<br>(202, 2, &#39;Software Engineer&#39;, 85000, &#39;2022-01-01&#39;, NULL),<br>(203, 2, &#39;Software Engineer&#39;, 85000, &#39;2020-10-05&#39;, NULL),<br>(204, 2, &#39;Software Engineer&#39;, 82000, &#39;2018-03-12&#39;, &#39;2020-06-30&#39;),<br>(204, 2, &#39;Software Engineer&#39;, 83000, &#39;2020-07-01&#39;, NULL),<br>(205, 2, &#39;QA Engineer&#39;, 68000, &#39;2021-01-18&#39;, &#39;2021-12-31&#39;),<br>(205, 2, &#39;QA Engineer&#39;, 70000, &#39;2022-01-01&#39;, NULL),<br>(206, 2, &#39;QA Engineer&#39;, 71000, &#39;2022-06-20&#39;, NULL),<br>(207, 2, &#39;DevOps Engineer&#39;, 74000, &#39;2017-09-01&#39;, &#39;2020-12-31&#39;),<br>(207, 2, &#39;DevOps Engineer&#39;, 75000, &#39;2021-01-01&#39;, NULL),<br>(208, 2, &#39;DevOps Engineer&#39;, 74000, &#39;2016-12-30&#39;, NULL),<br>(209, 2, &#39;Software Engineer&#39;, 86000, &#39;2019-11-14&#39;, NULL),<br>(210, 2, &#39;Software Engineer&#39;, 88000, &#39;2023-03-03&#39;, NULL);<br>INSERT INTO EmployeeHistory (EmployeeID, DepartmentID, JobTitle, Salary, StartDate, EndDate) VALUES<br>(301, 3, &#39;HR Associate&#39;, 65000, &#39;2013-05-07&#39;, &#39;2016-12-31&#39;),<br>(301, 3, &#39;HR Manager&#39;, 80000, &#39;2017-01-01&#39;, NULL),<br>(302, 3, &#39;HR Assistant&#39;, 48000, &#39;2019-07-12&#39;, &#39;2020-12-31&#39;),<br>(302, 3, &#39;HR Executive&#39;, 55000, &#39;2021-01-01&#39;, NULL),<br>(303, 3, &#39;HR Executive&#39;, 56000, &#39;2020-08-25&#39;, NULL),<br>(304, 3, &#39;Recruiter&#39;, 51000, &#39;2021-04-19&#39;, NULL),<br>(305, 3, &#39;Recruiter&#39;, 53000, &#39;2022-09-30&#39;, NULL),<br>(306, 3, &#39;HR Associate&#39;, 48000, &#39;2017-01-15&#39;, NULL),<br>(307, 3, &#39;HR Associate&#39;, 47000, &#39;2018-03-11&#39;, NULL),<br>(308, 3, &#39;HR Associate&#39;, 46000, &#39;2019-05-05&#39;, NULL),<br>(309, 3, &#39;HR Executive&#39;, 54000, &#39;2016-11-17&#39;, NULL),<br>(310, 3, &#39;Recruiter&#39;, 51000, &#39;2023-02-28&#39;, NULL);<br>INSERT INTO EmployeeHistory (EmployeeID, DepartmentID, JobTitle, Salary, StartDate, EndDate) VALUES<br>(401, 4, &#39;Accountant&#39;, 85000, &#39;2012-10-21&#39;, &#39;2015-12-31&#39;),<br>(401, 4, &#39;Finance Manager&#39;, 95000, &#39;2016-01-01&#39;, NULL),<br>(402, 4, &#39;Accountant&#39;, 62000, &#39;2018-12-01&#39;, &#39;2019-12-31&#39;),<br>(402, 4, &#39;Accountant&#39;, 65000, &#39;2020-01-01&#39;, NULL),<br>(403, 4, &#39;Accountant&#39;, 66000, &#39;2019-01-10&#39;, NULL),<br>(404, 4, &#39;Financial Analyst&#39;, 68000, &#39;2020-06-15&#39;, &#39;2020-12-31&#39;),<br>(404, 4, &#39;Financial Analyst&#39;, 70000, &#39;2021-01-01&#39;, NULL),<br>(405, 4, &#39;Financial Analyst&#39;, 71000, &#39;2021-09-22&#39;, NULL),<br>(406, 4, &#39;Accountant&#39;, 60000, &#39;2017-07-19&#39;, &#39;2018-12-31&#39;),<br>(406, 4, &#39;Accountant&#39;, 64000, &#39;2019-01-01&#39;, NULL),<br>(407, 4, &#39;Accountant&#39;, 61000, &#39;2016-05-27&#39;, &#39;2017-12-31&#39;),<br>(407, 4, &#39;Accountant&#39;, 63000, &#39;2018-01-01&#39;, NULL),<br>(408, 4, &#39;Financial Analyst&#39;, 70000, &#39;2015-08-09&#39;, &#39;2016-12-31&#39;),<br>(408, 4, &#39;Financial Analyst&#39;, 72000, &#39;2017-01-01&#39;, NULL),<br>(409, 4, &#39;Accountant&#39;, 65000, &#39;2022-11-11&#39;, NULL),<br>(410, 4, &#39;Accountant&#39;, 64000, &#39;2023-04-01&#39;, NULL);</pre><h3>Interview Questions Topic Wise</h3><h4>Salary-related Queries</h4><ol><li>How can you find the employee with the second-highest salary?</li><li>How do you retrieve the nth highest salary from the employee records?</li><li>How can you list all employees earning more than the average salary?</li><li>How do you fetch the top five employees with the highest salaries?</li><li>How can you calculate the total sum of all employees’ salaries?</li><li>How can you select employees who earn between $ 50,000 and $ 100,000?</li><li>How do you select employees whose salary is a multiple of 10,000?</li><li>How can you find employees who share the same salary?</li><li>How do you increase the salary of all employees by 10%?</li><li>How do you update salaries with different increments for different departments?</li><li>How do you find the highest-paid employee in every department?</li><li>How do you find the maximum and minimum salaries within each department?</li><li>How do you calculate the total and average salary per department?</li><li>How do you find employees earning more than the average salary of their department?</li><li>How do you find employees earning more than their managers?</li><li>How do you find the top three highest-paid employees in each department?</li><li>How can you calculate the average salary of the top five earners in each department?</li><li>How can you identify employees whose salaries are in the top 10 percentile?</li><li>How do you display the highest, lowest, and average salary for each job role?</li><li>How do you group employees by salary ranges such as 0–20K and 20K–50K?</li></ol><h4>Employee Count and Grouping Queries</h4><ol><li>How do you get the count of employees in each department?</li><li>How can you find the department with the highest number of employees?</li><li>How can you find the department with the lowest average salary?</li><li>How do you count the total number of departments in the company?</li><li>How can you get the total number of employees grouped by their job titles?</li><li>How can you find managers who have more than five direct reports?</li><li>How do you calculate the percentage distribution of employees across departments?</li><li>How do you group employees based on their age ranges (e.g., 20–30, 31–40)?</li></ol><h4>Employee Identification and Filtering by Attributes</h4><ol><li>How do you find employees who joined the company in the year 2022?</li><li>How do you find employees hired within the last six months?</li><li>How can you display employees with more than five years of tenure?</li><li>How can you list employees with more than five years of experience in each department?</li><li>How do you find employees older than 30 years?</li><li>How do you select employees earning between 50,000 and 100,000?</li><li>How do you list employees who do not receive any bonus?</li><li>How can you find employees whose names start with the letter ‘A’?</li><li>How do you find employees whose names end with the letter ‘n’?</li><li>How do you count employees whose names start and end with the same letter?</li><li>How can you find employees with the same first name?</li><li>How can you find employees whose email addresses contain the domain ‘@example.com’?</li><li>How can you find employees who do not have a department?</li><li>How can you find employees who do not have a manager?</li><li>How can you find employees who do not have any subordinates?</li></ol><h4>Hierarchy and Reporting Structure Queries</h4><ol><li>How can you list employees reporting to a specific manager?</li><li>How can you list employees reporting to the same manager?</li><li>How can you find employees who joined in the same month and year as their managers?</li><li>How do you find employees earning more than their managers?</li><li>How can you find managers who have more than five direct reports?</li></ol><h4>Formatting and Output Queries</h4><ol><li>How do you export all employee records in XML format?</li><li>How can you concatenate employee names and their salaries into a single string?</li><li>How do you display employee names alongside their hire dates formatted as “Name — MM/DD/YYYY”?</li><li>How do you display the hire date along with the day of the week for each employee?</li></ol><h4>Data Modification Queries</h4><ol><li>How do you increase the salary of all employees by 10%?</li><li>How do you update salaries with different increments for different departments?</li><li>How do you delete all employees belonging to a specific department?</li><li>How do you remove employees who have worked for more than 15 years?</li></ol><p>Try to solve these Questions with the provided data set and comment on your answers.</p><p>But don’t worry, stay tuned to me as I will prepare all possible ways to answer each question and come up with a new post for answers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d32d5ae57845" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/top-sql-interview-questions-on-employee-and-department-tables-d32d5ae57845">Top SQL Interview Questions on Employee and Department Tables</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>