Difference between revisions of "SQL"
From Coder Merlin
Line 1: | Line 1: | ||
== Configuration File == | == Configuration File == | ||
== Employees == | |||
Create a file named {{Pathname|~/.my.cnf}} in your home directory containing the following: | Create a file named {{Pathname|~/.my.cnf}} in your home directory containing the following: | ||
<pre> | <pre> | ||
Line 7: | Line 8: | ||
user=employees_user | user=employees_user | ||
password=N@!S%9poX5HE,CdPJ6_2 | password=N@!S%9poX5HE,CdPJ6_2 | ||
</pre> | |||
=== Sakilla === | |||
<pre> | |||
[client] | |||
host=db | |||
database=sakila | |||
user=sakila-user | |||
password="J4wZwE:}.5RySc-" | |||
</pre> | </pre> | ||
Latest revision as of 11:17, 26 January 2023
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)