Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[sqlfluff]
dialect = postgres
exclude_rules = LT01, CP02
exclude_rules = LT01, LT05, CP02

[sqlfluff:rules]
keywords_capitalisation_policy = upper
max_line_length = 100
max_line_length = 120
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Leetcode (PostgreSQL)

[![MIT licensed](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
[![CI](https://github.com/ivanbyone/hookify/actions/workflows/ci.yml/badge.svg)](https://github.com/Ivanbyone/leetcode-sql//actions)
[![CI](https://github.com/ivanbyone/leetcode-sql/actions/workflows/ci.yml/badge.svg)](https://github.com/Ivanbyone/leetcode-sql//actions)

## Description

Expand Down Expand Up @@ -33,8 +33,9 @@ Have a good contributing!
## Task List

1. [Easy](./leetcode/easy/)
- [182. Duplicate Emails](./leetcode/easy/182.%20Duplicate%20Emails.sql)
- [175. Combine Two Tables](./leetcode//easy/175.%20Combine%20Two%20Tables.sql)
- [181. Employees Earning More Than Their Managers](./leetcode/easy/181.%20Employees%20Earning%20More%20Than%20Their%20Managers.sql)
- [182. Duplicate Emails](./leetcode/easy/182.%20Duplicate%20Emails.sql)
- [183. Customers Who Never Order](./leetcode/easy/183.%20Customers%20Who%20Never%20Order.sql)
- [511. Game Play Analysis 1](./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql)
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
Expand Down
32 changes: 32 additions & 0 deletions leetcode/easy/181. Employees Earning More Than Their Managers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Question 181. Employees Earning More Than Their Managers
Link:
https://leetcode.com/problems/employees-earning-more-than-their-managers/description/

Table: Employee

+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| name | varchar |
| salary | int |
| managerId | int |
+-------------+---------+
id is the primary key (column with unique values) for this table.
Each row of this table indicates the ID of an employee,
their name, salary, and the ID of their manager.


Write a solution to find the employees who earn more
than their managers.

Return the result table in any order.
*/

SELECT t1.name AS Employee
FROM Employee AS t1
JOIN
Employee AS t2
ON t1.managerId = t2.id
WHERE t1.salary > t2.salary
Loading