SQL
From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Configuration File[edit]
Employees[edit]
Create a file named ~/.my.cnf in your home directory containing the following:
[client] host=db database=employees user=employees_user password=N@!S%9poX5HE,CdPJ6_2
Sakilla[edit]
[client] host=db database=sakila user=sakila-user password="J4wZwE:}.5RySc-"
LOGIN Topics[edit]
- Successfully log in to a database using command line options
- Successfully log in to a database using a configuration file
SHOW Topics[edit]
- Show all tables in a specified database
- Show all columns from a specified table
Column Types[edit]
- CHAR
- VARCHAR
- TEXT
- BLOB
- ENUM
- SET
- BOOLEAN
- INT
- FLOAT
- DOUBLE
- DECIMAL
- DATE
- TIME
- DATETIME
- TIMESTAMP
- NULL
SELECT Topics[edit]
- Selecting constants
- Select all records from a specified table
- Select specific columns from a specified table
- Select non-repeating (distinct) records from a specified table
- Column aliases
Ordering Records[edit]
- Ordering records with a single column
- Ordering records with multiple columns
Filters[edit]
- Using where
- Using logical operators
- Using NULL
- Using LIKE and wildcards
- Using IN
- Using BETWEEN
Aggregate Queries[edit]
- Count
- Average
- Maximum
- Minimum
- Sum
Joins[edit]
- Inner
- Left
- Right
- Outer
- Self
Unions[edit]
- Union (distinct)
- Union (all)