LeetCode 627: Swap Salary
A SQL update solution for swapping all m and f values in the Salary table using a single statement.
39 notes
A SQL update solution for swapping all m and f values in the Salary table using a single statement.
A SQL solution for swapping every pair of adjacent student seats while leaving the final seat unchanged when the row count is odd.
A SQL guide for filtering movies with odd IDs and non-boring descriptions, then sorting by rating.
A SQL guide for finding the largest number that appears exactly once in a table.
A SQL guide for pivoting rows into columns using ranking and conditional aggregation.
A SQL guide for comparing each department's monthly average salary against the company's monthly average salary.
A SQL guide for finding users who both follow someone and have followers, then counting how many followers they have.
A SQL guide for finding the minimum distance between any two unique points on the X-axis.
A SQL guide for finding the minimum Euclidean distance between any two points in a 2D plane.
A SQL guide for checking whether three side lengths can form a valid triangle using the triangle inequality.
A SQL guide for classifying binary tree nodes as Root, Inner, or Leaf based on parent-child relationships.
A SQL guide for finding salespeople who never had an order related to the company named RED.
A SQL guide for finding all cinema seats that are free and adjacent to at least one other free seat.
A SQL guide for counting friendships from both requester and accepter sides, then returning the user with the most friends.
A SQL guide for finding stadium records that belong to runs of at least three consecutive ids where each row has at least 100 people.
A clear SQL guide for computing the overall friend request acceptance rate with duplicate pairs counted once.
A clear SQL guide for finding classes that have at least five students.
A clear SQL guide for finding countries with either large area or large population.
A clear SQL guide for finding the customer who placed the most orders.
A clear SQL guide for summing 2016 investments for policies with repeated 2015 investment values and unique locations.
A clear SQL guide for selecting customers who were not referred by customer 2, including customers with no referee.
A clear SQL guide for counting students in every department, including departments with zero students.
A clear SQL guide for computing each employee's 3-month cumulative salary while excluding their most recent month.
A clear SQL guide for finding the question with the highest answer rate from survey logs.
A clear SQL guide for finding employees whose bonus is less than 1000 or missing.
A clear explanation of Winning Candidate using SQL aggregation to count votes and return the candidate with the most votes.
A clear explanation of Find Median Given Frequency of Numbers using cumulative frequency and SQL window functions.
A clear explanation of Managers with at Least 5 Direct Reports using grouping and a self join.
A clear explanation of Median Employee Salary using SQL window functions to rank employees inside each company.
A clear explanation of the Trips and Users SQL problem using joins, filtering, grouping, and conditional aggregation.
A clear SQL solution for finding employees whose salaries are in the top three unique salary levels within their department.
A clear SQL solution for finding every employee who earns the highest salary in their department.
A clear SQL solution for finding customers who have no matching rows in the Orders table.
A clear SQL solution for reporting email values that appear more than once in the Person table.
A clear SQL solution for finding employees whose salary is greater than their manager's salary using a self join.
A clear SQL solution for finding numbers that appear at least three times consecutively in the Logs table.
A clear SQL solution for ranking scores with dense ranking, where ties share the same rank and no rank numbers are skipped.
A clear SQL solution for finding the nth highest distinct salary from the Employee table.
A clear SQL solution for finding the second highest distinct salary from the Employee table.