![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQL
文章平均质量分 51
Nightonke
学生而已,请多指教。
展开
-
LeetCode OJ 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原创 2015-04-11 17:00:46 · 549 阅读 · 0 评论 -
LeetCode 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.原创 2015-04-12 18:43:33 · 588 阅读 · 0 评论 -
Postgresql 自增语句
如果只是简单地从1开始,递增值为1,可以这样写,serail是一种特殊的类型: 往Employee中添加值及其结果: 如果想设置更加详细的项,比如起始、递增值、最大值、最小值,可以定义一个sequence。 在sequence中,如果是no minvalue、no maxvalue表示最小最大值为-1,注意最小值不能大于最大值.。 然后改变表格的列: 往E原创 2015-04-12 18:07:36 · 3279 阅读 · 0 评论 -
LeetCode OJ 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 |原创 2015-04-12 14:29:12 · 723 阅读 · 0 评论 -
LeetCode 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(DA原创 2015-04-12 10:59:28 · 941 阅读 · 0 评论 -
LeetCode OJ 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原创 2015-04-12 15:51:24 · 702 阅读 · 0 评论 -
LeetCode 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 | +----+-----原创 2015-04-12 12:19:47 · 1101 阅读 · 0 评论 -
LeetCode 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 | Departme原创 2015-04-12 15:21:01 · 719 阅读 · 0 评论 -
LeetCode 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 | Na原创 2015-04-12 14:08:18 · 661 阅读 · 0 评论 -
LeetCode OJ Combine Two Tables
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId | int | | FirstName | varchar | | LastName | varchar | +-------------+---------+ Per原创 2015-04-11 19:48:45 · 589 阅读 · 0 评论 -
LeetCode 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原创 2015-04-12 22:58:46 · 576 阅读 · 0 评论 -
LeetCode 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 exa原创 2015-04-11 22:50:15 · 708 阅读 · 0 评论 -
LeetCode Department Top Three Salaries
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 | +--原创 2015-04-13 19:47:44 · 754 阅读 · 0 评论