From (SQL)
The FROM clause in SQL defines the use of one or more tables in a query. As a reserved word in the SQL standard , the general form of a query is:
SELECTSpaltennameFROMTabellenname [WHEREBedingung]
The FROMclause specifies the tables for rows to be deleted within delete statements and defines the tables for queries in subqueries of update statements. Tables , views or information schemes (general database information) form the basis for the FROMclause.
Examples
Output only rows of the table myTable with column values of myColumn greater than 100:
SELECT *
FROM   meineTabelle
WHERE  meineSpalte > 100
Remove all entries from the Trees table with a height less than 80.
DELETE FROM Bäume
 WHERE Höhe < 80;
Use the FROMclause in a subquery (also called a subquery) to define the conditions for selecting rows to be changed:
UPDATE T1
   SET C1 = 2
 WHERE C2 IN ( SELECT C3
                 FROM T2
                WHERE C4 = 0)
Database operations without FROM
Some DBMS do FROMnot need the clause to return a single value or line. In database system from Oracle this works for. B. via the so-called DUAL table:
SELECT 3.14 AS Kreiszahl
However, other systems also require a key word (also called a keyword) to select the relevant data:
SELECT to_char(sysdate, 'Dy DD-Mon-YYYY HH24:MI:SS') as "Aktuelle Zeit"
FROM dual;
In Sybase, the output of global variables such as the version used does not require a FROMclause:
SELECT @@version
A UPDATEstatement without a subquery does not need a FROMclause:
UPDATE t1 SET col1 = col1 + 1
See also
Individual evidence
- ^ Microsoft : From clause in Transact SQL. Retrieved December 3, 2018 .
- ↑ Drupal : Reserved Words in SQL. Retrieved December 3, 2018 .
- ^ Microsoft : System Information Schema Views (Transact-SQL). Retrieved December 3, 2018 .
- ^ Oracle : Selecting from the DUAL Table. Retrieved December 3, 2018 .
- ↑ Infolab Stanford University : Oracle Dates and Times. Retrieved December 3, 2018 .
- ↑ Sybase : Sybooks Online: Chapter 2: SQL Language Elements: Global variables. Retrieved December 3, 2018 .
- ^ MySQL : UPDATE syntax. Retrieved December 3, 2018 .
