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>")
 
Line 8: Line 8:
password=N@!S%9poX5HE,CdPJ6_2
password=N@!S%9poX5HE,CdPJ6_2
</pre>
</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
=== Ordering Records ===
* Ordering records with a single column
* Ordering records with multiple columns
=== Filters ===
* Using where
* Using logical operators
* Using NULL
=== Aggregate Queries ===
* Count
* Average
* Maximum
* Minimum

Revision as of 19:46, 17 January 2023

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Configuration File[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

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

Ordering Records[edit]

  • Ordering records with a single column
  • Ordering records with multiple columns

Filters[edit]

  • Using where
  • Using logical operators
  • Using NULL

Aggregate Queries[edit]

  • Count
  • Average
  • Maximum
  • Minimum