Guessing Game
- Read more about Guessing Game
- 1 comment
- Log in or register to post comments
- 183 views
The HAVING Clause is always used after the GROUP BY clause, it can not come without the GROUP BY clause. It works the same as the WHERE Clause, it is therefore also used to apply conditions on the aggregate_functions which was impossible by using simple WHERE clause.
The HAVING clause simply contains the conditions to filter data just like in WHERE clause.
SQL HAVING Syntax
A FOREIGN KEY is a key in another table that relates from the PRIMARY KEY in the parent table. A Foreign Key is needed in the related table to connect data from the primary table.
Let's take a look at the following example
Course Table
CourseID | Course |
1 | Math 101 |
2 | English 101 |
Students Table
Every table must be identified with a unique key or the Primary Key. Primary Key uniquely identifies each record in the table. It makes searching of record faster.
A Primary Key cannot contain a NULL values and must be unique in every record.
Different DBMS have different implementations to set the primary keys, so let’s see each of them below.
SQL PRIMARY KEY Syntax