본문 바로가기
728x90

SQL15

[leetcode] MySQL > 596. Classes More Than 5 Students 문제. leetcode database 180. Consecutive Numbers SQL Schema & Explanation There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 students. For example, the table: +---------+------------+ | student | class | +---------+------------+ | A | Math | | B | English | | C | Math | | D | Biology | | E | Math | | F | Computer | | G | Math | |.. 2021. 2. 8.
[leetcode] MySQL > 180. Consecutive Numbers 문제. leetcode database 180. Consecutive Numbers SQL Schema & Explanation Write a SQL query to find all numbers that appear at least three times consecutively. +----+-----+ | Id | Num | +----+-----+ | 1 | 1 | | 2 | 1 | | 3 | 1 | | 4 | 2 | | 5 | 1 | | 6 | 2 | | 7 | 2 | +----+-----+ For example, given the above Logs table, 1 is the only number that appears consecutively for at least three times. +--.. 2020. 9. 14.
[leetcode] MySQL > 183. Customers Who Never Order 문제. leetcode Database 183. Customers Who Never Order SQL Schema & Explanation Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything. Table: Customers. +----+-------+ | Id | Name | +----+-------+ | 1 | Joe | | 2 | Henry | | 3 | Sam | | 4 | Max | +----+-------+ Table: Orders. +----+------------+ | Id |.. 2020. 9. 12.
[leetcode] MySQL > 185. Department Top Three Salaries leetcode Database 185. Department Top Three Salaries SQL Schema & Explanation The Employee table holds all employees. Every employee has an Id, and there is also a column for the department Id. +----+-------+--------+--------------+ | Id | Name | Salary | DepartmentId | +----+-------+--------+--------------+ | 1 | Joe | 85000 | 1 | | 2 | Henry | 80000 | 2 | | 3 | Sam | 60000 | 2 | | 4 | Max | 90.. 2020. 9. 11.
[leetcode] MySQL > 178. Rank Scores 문제. 178. Rank Scores SQL Schema & Explantion Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer value. In other words, there should be no "holes" between ranks. +----+-------+ | Id | Score | +----+-------+ | 1 | 3.50 | | 2 | 3.65 | | 3 | 4.00 | | 4 | 3.85 .. 2020. 9. 9.
[leetcode] MySQL > 184. Department Highest Salary 문제. Leetcode SQL, 184. Department Highest Salary SQL Schema. The Employee table holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id. +----+-------+--------+--------------+ | Id | Name | Salary | DepartmentId | +----+-------+--------+--------------+ | 1 | Joe | 70000 | 1 | | 2 | Jim | 90000 | 1 | | 3 | Henry | 80000 | 2 | | 4 | Sam | 60000 | 2.. 2020. 9. 8.
728x90