Topics Covered in this Page
  1. Database Normalization
  2. Primary Key, Candidate Key
  3. Constraints
  4. ORDER BY
  5. IN
  6. BETWEEN
  7. MIN/MAX
  8. UNION
  9. JOIN
  10. GROUP BY
  11. LIMIT and OFFSET
  12. IFNULL
  13. Basic Operations
  14. NULL values
  15. LIKE
  16. alias
  17. SELECT...INTO
  18. INSERT INTO..SELECT...
  19. Stored Procedure
  20. Trigger
  21. Query Questions
Database Normalization Primary Key, Candidate Key, Foreign Key Constraints ORDER BY IN BETWEEN MIN/MAX UNION JOIN GROUP BY LIMIT and OFFSET
SELECT column FROM table LIMIT 18 OFFSET 8;
Start by reading the query from offset. First you offset by 8, which means you skip the first 8 results of the query. Then you limit by 18. Which means you consider records 9, 10, 11, 12, 13, 14, 15, 16....24, 25, 26 which are a total of 18 records.

IFNULL Basic Operations
Insert:
INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
Update:
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
Delete:
DELETE FROM table_name WHERE condition;
Alter:
ALTER TABLE table_name ADD column_name datatype;
ALTER TABLE Customers DROP COLUMN Email; ALTER TABLE table_name MODIFY COLUMN column_name datatype;
NULL value
A field with a NULL value is a field with no value.
How to test if a data is NULL?: use IS NULL

LIKE operator
SELECT column1, column2, ... FROM table_name WHERE columnN LIKE pattern;

Aliases
Alias Column Syntax
SELECT column_name AS alias_name FROM table_name;
Alias Table Syntax
SELECT column_name(s) FROM table_name AS alias_name;

SELECT...INTO INSERT INTO...SELECT... Stored Procedure Trigger Query Questions