From (SQL)
Die From-Klausel in SQL definiert die Zeilenmenge aus einer oder mehrerer Tabellen für die Anweisungen der Datenbearbeitungssprache DML.
FROM
ist ein reserviertes Wort im SQL-Standard und hat in Verbindung mit einer Select-Anweisung die folgende Form: [1] [2]
SELECT
SpaltennameFROM
Tabellenname [WHERE
Bedingung]
Weitere Verwendungsmöglichkeiten sind aus weiteren Tabellen entnommene Werte für Update-Anweisungen oder Zeilen die in einer Delete-Anweisung gelöscht werden sollen.
The From clause can generally be anything that returns a rowset, a table, view, function, or system-provided information like the "Information Schema", which is typically running proprietary commands and returning the information in a table form.[3]
Beispiele
The following query returns only those rows from table mytable where the value in column mycol is greater than 100.
SELECT *
FROM mytable
WHERE mycol > 100
Anforderungen
The From clause is technically required in relational algebra and in most scenarios to be useful. However many relational DBMS implementations may not require it for selecting a single value, or single row - known as "DUAL table" im Datenbanksystem von Oracle.[4]
SELECT 3.14 AS Pi
Other systems will require a From statement with a keyword, even to select system data.[5]
select to_char(sysdate, 'Dy DD-Mon-YYYY HH24:MI:SS') as "Current Time"
from dual;
Einzelnachweise
- ↑ From clause in Transact SQL.
- ↑ Reserved Words in SQL.
- ↑ System Information Schema Views (Transact-SQL).
- ↑ Selecting from the DUAL Table.
- ↑ Oracle Dates and Times.
[[Kategorie:SQL]]