数据库
zhengdd1
There is nothing sadder than a dream delays until it fades forever
展开
-
leetcode-db 组合两个表
直接使用Left join 。如果使用where的话如果右表不存在匹配的行,那么不会返回数据,所以用Left join。 select p.FirstName, p.LastName, a.City,a.State from Person p left join Address a on p.PersonId = a.PersonId...原创 2018-03-27 09:41:10 · 1086 阅读 · 0 评论 -
leetcode 第二高薪水
直接查询如果不存在第二高的Salary不会返回值,所以应该用子查询 select (select distinct Salary from Employee order by Salary desc limit 1,1) as SecondHighestSalary 也可以用IFNULL ifnull(exr1,exr2) 如果exr1是null那么返回exr2否则返回exr1 sel...原创 2018-03-27 10:19:16 · 506 阅读 · 0 评论 -
leetcode 超过经理收入的员工
Select e1.Name as Employee from Employee e1 , Employee e2 where e1.ManagerId = e2.Id and e1.Salary > e2.Salary 或者使用join # Write your MySQL query statement below Select e1.Name as Employee from...原创 2018-03-27 10:34:39 · 3676 阅读 · 0 评论 -
spring data jpa 快速使用
依赖 maven依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> ...原创 2018-04-28 17:26:32 · 356 阅读 · 0 评论