摘要: 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 阅读全文
posted @ 2015-12-21 20:14 Miller_S 阅读(348) 评论(0) 推荐(0) 编辑
摘要:   思路: 两种思路,可以给当成两个表也可以给当成一张表来做 group by就是按照某个属性给表分个组,然后having语句的含义是“对于每一个group”怎么怎么样   补充知识:count(column),count(distinct column),count(*)的区别 对于符合条件(通过 阅读全文
posted @ 2015-12-21 15:57 Miller_S 阅读(195) 评论(0) 推荐(0) 编辑
摘要:   思路: 今天复习数据库突然想起来leetcode上数据库的题目,就找来做了 (1)给表取别名 格式见code,这在自身连接的时候是很有必要的 (2)自身连接 from语句后面相当于接了“一张表”,如果是多个表,就相当于形成了他们的笛卡尔积 然后通过where语句选择出所需要的行,通过头上的sel 阅读全文
posted @ 2015-12-21 14:52 Miller_S 阅读(168) 评论(0) 推荐(0) 编辑