Nested Select Statements in MySQL!

Nested select statements can return a single value, a single row, a column, or a table. The subquery in the first example shown below selects only Clayton Kershaw (playerID = “kershcl01”) in 2014. 314 more words

Group By




  • 1. FROM FROM后面的表标识了这条语句要查询的数据源。和一些子句如,(1-J1)笛卡尔积,(1-J2)ON过滤,(1-J3)添加外部列,所要应用的对象。FROM过程之后会生成一个虚拟表VT1。
  • (1-J1)笛卡尔积 这个步骤会计算两个相关联表的笛卡尔积(CROSS JOIN) ,生成虚拟表VT1-J1。
  • (1-J2)ON过滤 这个步骤基于虚拟表VT1-J1这一个虚拟表进行过滤,过滤出所有满足ON 谓词条件的列,生成虚拟表VT1-J2。
  • (1-J3)添加外部行  如果使用了外连接,保留表中的不符合ON条件的列也会被加入到VT1-J2中,作为外部行,生成虚拟表VT1-J3。
  • 2. WHERE 对VT1过程中生成的临时表进行过滤,满足where子句的列被插入到VT2表中。
  • 3. GROUP BY 这个子句会把VT2中生成的表按照GROUP BY中的列进行分组。生成VT3表。
  • 4. HAVING 这个子句对VT3表中的不同的组进行过滤,满足HAVING条件的子句被加入到VT4表中。
  • 593 more words

Simple Split-Apply-Combine Operations in Outlier

Another important operation on tables is the ability to compute subtotals. In the relational world, these are implemented using summary operations (sum, max…) and group by. 275 more words

The Capabilities of a SQL SELECT Statement

Exam Topic: Retrieving Data Using the SQL SELECT Statement – List the capabilities of SQL SELECT statements

By far, the most important skill for anyone to possess when working with a database is the skill to extract from the database the data you want in the format you desire. 982 more words

SQL Fundamentals I

DAT601 Tuesday 2nd June Having and Group By

Today in class we covered SQL Group By and its applications;

This is a informative blog explaining the process by Ian Gilfillan

The HAVING Clause… 2,073 more words


DAT601 Tuesday 26th May Group By, Joins - Equi Joins

Today in class we continued to look at Group By and Join statements

An example of a join statement is below:

SELECT Product.ProductName AS ‘Name’,   Product.ProductDesc AS ‘Description’, Product.ProductPrice AS ‘Unit Price’ 333 more words


SQL Basics - Difference between WHERE, GROUP BY and HAVING clause

All these three Clauses are a part/extensions of a SQL Query, are used to Filter, Group & re-Filter rows returned by a Query respectively, and are optional. 432 more words