Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| modul:m290:learningunits:lu04:theorie:a_syntax [2024/08/30 09:30] – angelegt vdemir | modul:m290:learningunits:lu04:theorie:a_syntax [2024/10/17 12:33] (aktuell) – vdemir | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== | + | ====== |
| - | ... | + | |
| + | As we know, **SQL** stands for **S**tructured **Q**uery **L**anguage. Consequently, | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===== NOTES ===== | ||
| + | * The content of this chapter is based on the [[https:// | ||
| + | * Please note that the use og CAPITAL LETTERS for SQL commands and tabs can make it easier for you to maintain your program code. | ||
| + | * Make sure, that every complete sql statement is finished by a semicolon (;). | ||
| + | |||
| + | ===== The Syntax of DML commands | ||
| + | Every SQL query is composed by three main commands: | ||
| + | |||
| + | * **SELECT** myColumn1, myColumn2, ... [or * for all columns] | ||
| + | * **FROM** myTable | ||
| + | * **WHERE** myCondition. | ||
| + | * **ORDER BY** myColumn2 **ASC|DESC**; | ||
| + | |||
| + | With **SELECT** we specify which columns we want to retrieve, with **FROM** we specify the TABLE from which the columns originate, with **WHERE** we determine the condition under which the data records are selected, and finally, with **ORDER BY** + **[ASC | DESC]** we define the order in which the result set is to be displayed on the screen. | ||
| + | |||
| + | ===== Basic example | ||
| + | Let's take a table **Customers** as shown in the figure below. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | To retrieve all the information, | ||
| + | |||
| + | | ||
| + | FROM Customers; | ||
| + | |||
| + | or as a more detailed notation | ||
| + | |||
| + | | ||
| + | FROM Customers; | ||
| + | |||
| + | The result set would include the entire contents of the table, since we we have not defined any preconditions or filters. | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| - | ===== ... ==== | ||
| ===== Vocabulary ===== | ===== Vocabulary ===== | ||
| ^ English ^ German ^ | ^ English ^ German ^ | ||
| - | | ... | ... | | + | | precondition |
| + | | exhaustive | ||
| + | | clause | Abschnitt | | ||
| + | | to determine | bestimmen | | ||
| + | | to fetch | abrufen, holen | | ||
| + | | be composed by | besteht aus | | ||
| + | | notation | Schreibweise | | ||
| ---- | ---- | ||
| [[https:// | [[https:// | ||