摘要: 地址:https://leetcode-cn.com/problems/delete-duplicate-emails/ ## 编写一个 SQL 查询,来删除 Person 表中所有重复的电子邮箱,重复的邮箱里只保留 Id 最小 的那个。 示例: + + + | Id | Email | + + + 阅读全文
posted @ 2020-03-26 17:52 花花妹子。 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/reformat-department-table/ ## 编写一个 SQL 查询来重新格式化表,使得新的表中有一个部门 id 列和一些对应 每个月 的收入(revenue)列。 示例: 部门表 Department: + + 阅读全文
posted @ 2020-03-26 17:15 花花妹子。 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/customers-who-never-order/ ## 某网站包含两个表,Customers 表和 Orders 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。 示例: Customers 表: + + + | 阅读全文
posted @ 2020-03-26 16:55 花花妹子。 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/palindrome-number/ <?php /** 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 示例 1: 输入: 121 输出: true 示例 2: 输入: -121 输出 阅读全文
posted @ 2020-03-26 15:36 花花妹子。 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/binary-search/ <?php /** 给定一个 n 个元素有序的(升序)整型数组 nums 和一个目标值 target ,写一个函数搜索 nums 中的 target,如果目标值存在返回下标,否则返回 -1。 示例 阅读全文
posted @ 2020-03-26 14:38 花花妹子。 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/word-frequency/ ## 写一个 bash 脚本以统计一个文本文件 words.txt 中每个单词出现的频率。 示例: 为了简单起见,你可以假设: words.txt只包括小写字母和 ' ' 。 每个单词只由小写字母 阅读全文
posted @ 2020-03-26 12:03 花花妹子。 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/rising-temperature/ ## 给定一个 Weather 表,编写一个 SQL 查询,来查找与之前(昨天的)日期相比温度更高的所有日期的 Id。 示例: 给定一个 Weather 表,编写一个 SQL 查询,来查找 阅读全文
posted @ 2020-03-26 11:20 花花妹子。 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/employees-earning-more-than-their-managers/ ## 编写一个 SQL查询,交换所有的 f 和 m 值(例如,将所有 f 值更改为 m,反之亦然 示例: Employee 表包含所有员工, 阅读全文
posted @ 2020-03-26 10:52 花花妹子。 阅读(188) 评论(0) 推荐(0) 编辑