_FAQ For SQL
What is the difference between the HAVING clause and the WHERE?
- The WHERE clause used to filter individual rows before they are grouped together, while
HAVINGis used to filter groups after they are created by aGROUP BYclause.
- i.e., HAVING applies to the entire group of tuple, partitioned by the
GROUP BYclause.
Clause vs Keyword vs Statement?
- Statement: A complete SQL command to perform a specific task (e.g., querying, updating data, inserting data). Uses a combination of clauses and keywords.
- Clause: a clause is a part of a SQL statement that provides additional information about the operation being performed (e.g.,
WHERE,GROUP BY,HAVING,ORDER BY).
- Keyword: A keyword is a reserved word in SQL that has a specific meaning and purpose in the programming language.
What is the different between ASSERTION and CHECK?
- The
CHECKconstraint is used to enforce domain integrity by limiting the values that can be inserted into a column or a set of columns in a table. It is used to ensure that only valid data is entered into the table.
- While the
CHECKconstraint is used to enforce simple constraints on individual columns or sets of columns, theASSERTIONis used to enforce more complex constraints that involve multiple tables or multiple rows.