TABLE

The TABLE statement can be used instead of SELECT * FROM when no aggregation or complex filtering is needed.

Synopsis

TableStmt
TABLETableORDER BYColumnLIMITNUM

Examples

Create table t1:

CREATE TABLE t1(id INT PRIMARY KEY);

Insert some data into t1:

INSERT INTO t1 VALUES (1),(2),(3);

View the data in table t1:

TABLE t1;
+----+ | id | +----+ | 1 | | 2 | | 3 | +----+ 3 rows in set (0.01 sec)

Query t1 and sort the result by the id field in descending order:

TABLE t1 ORDER BY id DESC;
+----+ | id | +----+ | 3 | | 2 | | 1 | +----+ 3 rows in set (0.01 sec)

Query the first record in t1:

TABLE t1 LIMIT 1;
+----+ | id | +----+ | 1 | +----+ 1 row in set (0.01 sec)

MySQL compatibility

The TABLE statement was introduced in MySQL 8.0.19.

See also

Was this page helpful?