Version 2 vs 3
Version 2 vs 3
Edits
Edits
- Edit by keithzg, Version 3
- May 20 2019 9:31 PM
- ·Whoops
- Edit by keithzg, Version 2
- May 20 2019 9:29 PM
- ·Give an extra example
« Previous Change | Next Change » |
Edit Older Version 2... | Edit Older Version 3... |
Content Changes
Content Changes
= Basic Ideas and Syntax =
== Identifiers ==
[[https://mariadb.com/kb/en/library/identifier-names/ | Identifier Names]]: Databases, tables, indexes, columns, aliases, views, stored routines, triggers, events, variables, partitions, tablespaces, savepoints, labels, users, roles, are collectively known as identifiers, and have certain rules for naming.
Identifiers may be quoted using the backtick character (```). Quoting is optional for identifiers that don't contain special characters, or is a reserved word. LibreOffice Base can be picky if you don't quote things, though.
[[https://mariadb.com/kb/en/library/identifier-qualifiers/ | Identifier Qualifiers]]: Qualifiers are used within SQL statements to reference data structures, such as databases, tables, or columns. For example, typically a `SELECT` query contains references to some columns and at least one table.
```
lang=mysql, name=Example
# This selects the CLIENTID and SOLD columns from the Prosp_EW table, which is in turn in the client database.
SELECT `CLIENTID`, `SOLD` FROM `client`.`Prosp_EW`
```
Qualifiers can be composed by one or more identifiers, where the initial parts affect the context within which the final identifier is interpreted:
* For a database, only the database identifier needs to be specified.
* For objects which are contained in a database (like tables, views, functions, etc) the database identifier can be specified. If no database is specified, the current database is assumed.
* For column names, the table and the database are generally obvious from the context of the statement. It is however possible to specify the table identifier, or the database identifier plus the table identifier.
If a qualifier is composed by more than one identifier, a dot (`.`) must be used as a separator. All identifiers can be quoted individually. Extra spacing (including new lines and tabs) is allowed.
```
lang=mysql, name=Example
# This refers to the CLIENTID column in the Prosp_EW table, which is in turn in the client database.
`client`.`Prosp_EW`
```
== Literals (ie. Values) ==
[[ https://mariadb.com/kb/en/library/string-literals/ | Strings ]] are sequences of characters and are enclosed with quotes (`'`). Strings can either be enclosed in single quotes or in double quotes (the same character must be used to both open and close the string).
[[ https://mariadb.com/kb/en/library/numeric-iterals/ | Numeric literals ]] are unquoted.
[[ https://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html | Date and time values ]] can be represented in several formats, such as quoted strings or as numbers, depending on the exact type of the value and other factors. For example, in contexts where MySQL expects a date, it interprets any of `'2015-07-21'`, `'20150721'`, and `20150721` as a date.
= Basic Ideas and Syntax =
== Identifiers ==
[[https://mariadb.com/kb/en/library/identifier-names/ | Identifier Names]]: Databases, tables, indexes, columns, aliases, views, stored routines, triggers, events, variables, partitions, tablespaces, savepoints, labels, users, roles, are collectively known as identifiers, and have certain rules for naming.
Identifiers may be quoted using the backtick character (```). Quoting is optional for identifiers that don't contain special characters, or is a reserved word. LibreOffice Base can be picky if you don't quote things, though.
[[https://mariadb.com/kb/en/library/identifier-qualifiers/ | Identifier Qualifiers]]: Qualifiers are used within SQL statements to reference data structures, such as databases, tables, or columns. For example, typically a `SELECT` query contains references to some columns and at least one table.
```
lang=mysql, name=Example
# This selects the CLIENTID and SOLD columns from the Prosp_EW table, which is in turn in the client database.
SELECT `CLIENTID`, `SOLD` FROM `client`.`Prosp_EW`
```
Qualifiers can be composed by one or more identifiers, where the initial parts affect the context within which the final identifier is interpreted:
* For a database, only the database identifier needs to be specified.
* For objects which are contained in a database (like tables, views, functions, etc) the database identifier can be specified. If no database is specified, the current database is assumed.
* For column names, the table and the database are generally obvious from the context of the statement. It is however possible to specify the table identifier, or the database identifier plus the table identifier.
If a qualifier is composed by more than one identifier, a dot (`.`) must be used as a separator. All identifiers can be quoted individually. Extra spacing (including new lines and tabs) is allowed.
```
lang=mysql, name=Example
# This refers to the CLIENTID column in the Prosp_EW table, which is in turn in the client database.
`client`.`Prosp_EW`.`CLIENTID`
```
== Literals (ie. Values) ==
[[ https://mariadb.com/kb/en/library/string-literals/ | Strings ]] are sequences of characters and are enclosed with quotes (`'`). Strings can either be enclosed in single quotes or in double quotes (the same character must be used to both open and close the string).
[[ https://mariadb.com/kb/en/library/numeric-iterals/ | Numeric literals ]] are unquoted.
[[ https://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html | Date and time values ]] can be represented in several formats, such as quoted strings or as numbers, depending on the exact type of the value and other factors. For example, in contexts where MySQL expects a date, it interprets any of `'2015-07-21'`, `'20150721'`, and `20150721` as a date.
= Basic Ideas and Syntax =
== Identifiers ==
[[https://mariadb.com/kb/en/library/identifier-names/ | Identifier Names]]: Databases, tables, indexes, columns, aliases, views, stored routines, triggers, events, variables, partitions, tablespaces, savepoints, labels, users, roles, are collectively known as identifiers, and have certain rules for naming.
Identifiers may be quoted using the backtick character (```). Quoting is optional for identifiers that don't contain special characters, or is a reserved word. LibreOffice Base can be picky if you don't quote things, though.
[[https://mariadb.com/kb/en/library/identifier-qualifiers/ | Identifier Qualifiers]]: Qualifiers are used within SQL statements to reference data structures, such as databases, tables, or columns. For example, typically a `SELECT` query contains references to some columns and at least one table.
```
lang=mysql, name=Example
# This selects the CLIENTID and SOLD columns from the Prosp_EW table, which is in turn in the client database.
SELECT `CLIENTID`, `SOLD` FROM `client`.`Prosp_EW`
```
Qualifiers can be composed by one or more identifiers, where the initial parts affect the context within which the final identifier is interpreted:
* For a database, only the database identifier needs to be specified.
* For objects which are contained in a database (like tables, views, functions, etc) the database identifier can be specified. If no database is specified, the current database is assumed.
* For column names, the table and the database are generally obvious from the context of the statement. It is however possible to specify the table identifier, or the database identifier plus the table identifier.
If a qualifier is composed by more than one identifier, a dot (`.`) must be used as a separator. All identifiers can be quoted individually. Extra spacing (including new lines and tabs) is allowed.
```
lang=mysql, name=Example
# This refers to the CLIENTID column in the Prosp_EW table, which is in turn in the client database.
`client`.`Prosp_EW`.`CLIENTID`
```
== Literals (ie. Values) ==
[[ https://mariadb.com/kb/en/library/string-literals/ | Strings ]] are sequences of characters and are enclosed with quotes (`'`). Strings can either be enclosed in single quotes or in double quotes (the same character must be used to both open and close the string).
[[ https://mariadb.com/kb/en/library/numeric-iterals/ | Numeric literals ]] are unquoted.
[[ https://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html | Date and time values ]] can be represented in several formats, such as quoted strings or as numbers, depending on the exact type of the value and other factors. For example, in contexts where MySQL expects a date, it interprets any of `'2015-07-21'`, `'20150721'`, and `20150721` as a date.