LeetCode Database Solutions [Easy] 004 | Eugene Tsai

Eugene Tsai
3 min readJul 8, 2022

--

photo by Kari Shea

Introduction

This is the fourth article about the solutions of easy level database questions on LeetCode. As always, just a quick reminder, if you are a new reader about this topic, I am writing this article because I am practicing SQL queries recently, and I decide to note it down not only for personal future review, but also for people who are just new in this field. This is a serial article, thus, the links below are here to get you started, and do not forget to follow me, and click a clap in case missing any new articles.

LeetCode Database Questions

  1. No 595. Big Countries
  2. No 596. Classes More Than 5 Students
  3. No 607. Sales Person

Let’s get moving

No 595. Big Countries

Table: World

Question:

MySQL Solutions:

Approach I:

Approach II:

No 596. Classes More Than 5 Students

Table: Courses

Question:

MySQL Solutions:

Approach I:

Approach II:

No 607. Sales Person

Table: SalesPerson

Table: Company

Table: Orders

Question:

MySQL Solutions:

Approach I:

Approach II:

Conclusion

This is all for today. Above are the solutions of the three easy level database questions on LeetCode. There are still tons of SQL queries to solve these questions. Therefore, if you can come up with different or more efficient solutions, please be free to tell me or connect me on my LinkedIn for further discussion. Last, do not forget to follow me, and click a clap for me. Thank you for your time!

--

--