Difference between revisions of "SQL"

From Coder Merlin
(Created page with "== Configuration File == Create a file named {{Pathname|my.cnf}} in your home directory containing the following: <pre> [client] host=db database=employees user=employees_user password=N@!S%9poX5HE,CdPJ6_2 </pre>")
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Configuration File ==
== Configuration File ==
Create a file named {{Pathname|my.cnf}} in your home directory containing the following:
== Employees ==
Create a file named {{Pathname|~/.my.cnf}} in your home directory containing the following:
<pre>
<pre>
[client]
[client]
Line 8: Line 9:
password=N@!S%9poX5HE,CdPJ6_2
password=N@!S%9poX5HE,CdPJ6_2
</pre>
</pre>
=== Sakilla ===
<pre>
[client]
host=db
database=sakila
user=sakila-user
password="J4wZwE:}.5RySc-"
</pre>
== LOGIN Topics ==
* Successfully log in to a database using command line options
* Successfully log in to a database using a configuration file
== SHOW Topics ==
* Show all tables in a specified database
* Show all columns from a specified table
== Column Types ==
* CHAR
* VARCHAR
* TEXT
* BLOB
* ENUM
* SET
* BOOLEAN
* INT
* FLOAT
* DOUBLE
* DECIMAL
* DATE
* TIME
* DATETIME
* TIMESTAMP
* NULL
== SELECT Topics ==
* 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 ===
* Ordering records with a single column
* Ordering records with multiple columns
=== Filters ===
* Using where
* Using logical operators
* Using NULL
* Using LIKE and wildcards
* Using IN
* Using BETWEEN
=== Aggregate Queries ===
* Count
* Average
* Maximum
* Minimum
* Sum
=== Joins ===
* Inner
* Left
* Right
* Outer
* Self
=== Unions ===
* Union (distinct)
* Union (all)

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)