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 · 242 阅读 · 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 · 223 阅读 · 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 · 194 阅读 · 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 · 392 阅读 · 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 · 202 阅读 · 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 · 194 阅读 · 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 · 233 阅读 · 0 评论 -
175. Combine Two Tables
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId | int | | FirstName | varchar | | LastName | varchar | +-------------+---------+ Per原创 2017-04-16 13:07:35 · 180 阅读 · 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 · 205 阅读 · 0 评论 -
183. Customers Who Never Order
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原创 2017-04-16 13:23:30 · 234 阅读 · 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 · 298 阅读 · 0 评论 -
262. Trips and Users
262. Trips and Users Hard 158116FavoriteShare SQL Schema The 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 · 224 阅读 · 0 评论 -
626. Exchange Seats
626. Exchange Seats Medium 135126FavoriteShare SQL Schema Mary 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 · 490 阅读 · 0 评论 -
596. Classes More Than 5 Students
596. Classes More Than 5 Students Easy 132344FavoriteShare SQL Schema There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 stude...原创 2019-01-24 10:46:29 · 201 阅读 · 0 评论
分享