
SQL
文章平均质量分 69
SnailRunFast
这个作者很懒,什么都没留下…
展开
-
177. Nth Highest Salary
Write a SQL query to get the nth highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+For exampl原创 2017-04-16 16:52:58 · 216 阅读 · 0 评论 -
626. Exchange Seats
626. Exchange SeatsMedium135126FavoriteShareSQL SchemaMary is a teacher in a middle school and she has a table seat storing students' names and their corresponding seat ids.The column id is ...原创 2019-01-24 10:44:56 · 447 阅读 · 0 评论 -
262. Trips and Users
262. Trips and UsersHard158116FavoriteShareSQL SchemaThe Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are both foreign keys to the Users_Id at the...原创 2019-01-24 10:43:10 · 184 阅读 · 0 评论 -
197. Rising Temperature
Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates.+---------+------------+------------------+| Id(INT) | Date(DATE原创 2017-04-16 13:55:33 · 264 阅读 · 0 评论 -
183. Customers Who Never Order
Suppose that a website contains two tables, the Customers table and theOrders table. Write a SQL query to find all customers who never order anything.Table: Customers.+----+-------+| Id | Name原创 2017-04-16 13:23:30 · 201 阅读 · 0 评论 -
181. Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.+----+-------+--------+-----------+| Id | Name | Salary | M原创 2017-04-16 13:09:10 · 177 阅读 · 0 评论 -
175. Combine Two Tables
Table: Person+-------------+---------+| Column Name | Type |+-------------+---------+| PersonId | int || FirstName | varchar || LastName | varchar |+-------------+---------+Per原创 2017-04-16 13:07:35 · 152 阅读 · 0 评论 -
182. Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person.+----+---------+| Id | Email |+----+---------+| 1 | a@b.com || 2 | c@d.com || 3 | a@b.com |+----+---------+For ex原创 2017-04-16 13:06:20 · 191 阅读 · 0 评论 -
196. Delete Duplicate Emails
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.+----+------------------+| Id | Email |+----+---原创 2017-04-16 14:35:44 · 150 阅读 · 0 评论 -
176. Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+For examp原创 2017-04-16 14:53:48 · 166 阅读 · 0 评论 -
178. Rank Scores
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.原创 2017-04-16 15:22:34 · 351 阅读 · 0 评论 -
180. Consecutive Numbers
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原创 2017-04-16 16:08:40 · 163 阅读 · 0 评论 -
184. Department Highest Salary
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 | Department原创 2017-04-16 16:22:54 · 194 阅读 · 0 评论 -
596. Classes More Than 5 Students
596. Classes More Than 5 StudentsEasy132344FavoriteShareSQL SchemaThere is a table courses with columns: student and classPlease list out all classes which have more than or equal to 5 stude...原创 2019-01-24 10:46:29 · 155 阅读 · 0 评论