SQL is an international standard (ISO), but you will find many differences between implementations. This guide uses MySQL as an example. If you use one of the many other Relational Database Management Systems (DBMS) you'll need to check the manual for equivalent commands and syntax.
* ### Where Clause (and / or, IN, Between and LIKE) :
The WHERE clause is used to limit the number of rows returned.
In this case all five of these will be used in a somewhat ridiculous Where clause.
Compare this result to the above SQL statement to follow this logic.
Rows will be presented that:
* Have Student IDs between 1 and 5 (inclusive)
* or studentID = 8
* or have "Maximo" in the name
The following example is similar, but it further specifies that if any of the students have certain SAT scores (1000, 1400), they will not be presented:
Order By gives us a way to sort the result set by one or more of the items in the SELECT section. Here is the same list as above, but sorted by the student's Full Name. The default sort order is ascending (ASC), but to sort in the opposite order (descending) you use DESC, as in the example below:
```sql
select studentID, FullName, sat_score
from student
where (studentID between 1 and 5 -- inclusive
or studentID = 8
or FullName like '%Maximo%')
and sat_score NOT in (1000, 1400)
order by FullName DESC;
```
Result :
```text
+------------+---------------------+-----------+
| studentID | FullName | sat_score |
+------------+---------------------+-----------+
| 8 | Dean Pickel | 800 |
| 4 | Demetrius Mccaster | 1200 |
| 2 | Merle Veres | 800 |
| 7 | Maximo Backstrom | 1800 |
| 1 | Vincent Uvalle | 400 |
+------------+---------------------+-----------+
```
* ### Group By and Having :
Group By gives us a way to combine rows and aggregate data. The Having clause is like the above Where clause, except that it acts on the grouped data.
This data is from the campaign contributions dataset we've been using in some of these guides.
This SQL statement answers the question: "which candidates recieved the largest number of contributions (not $ amount, but count (\*)) in 2016, but only those who had more than 80 contributions?"
Ordering this data set in a descending (DESC) order places the candidates with the largest number of contributions at the top of the list.
*As with all of these SQL things there is MUCH MORE to them than what's in this introductory guide. I hope this at least gives you enough to get started. Please see the manual for your database manager and have fun trying different options yourself.*