Nope; it will ignore NULL values unless the function is about nulls. It's pretty robust that way.
There are others. There's CONCAT()
which can concatenate strings.
Min()
works on strings. Try it on the names in WMDB person table:
select min(name) from wmdb.person;
HAVING filters based on a property of the group, and individuals don't necessarily have those properties. For example, a single person does not have a property of "group size".
Last time, I mentioned this example: suppose we have a table of sales records for car dealerships. Each row records the date, amount, region, etc of that sale.
Suppose we (1) group by region and (2) choose regions where the total sales are over a million dollars.
A "total sales over a million" can't be a property of an individual sale, but it can be a property of a group of sales.
I'd be glad to. Let's use the sales example: Imagine (1) sorting the rows by region (2) iterating over them, computing aggregate values like total sales, and (3) reporting/returning one result per group.
We could equally well group
The IN
operator needs a single column of
results. The exists
operator can have any number of
columns and is just interested in whether there are any rows.
Sure. Let's look at the Clint Eastwood query
The way that a SQL statement is phrased is not always the same as the way it is executed. We aim for expressivity, and subqueries can help with that. Many students find the subquery version of the Clint Eastwood query easier to understand than the JOIN version.
Sure. I have a new example that I haven't added to the reading, but I may someday. Let's go look at that now.
Great!