Home >Database >Mysql Tutorial >Is There a PostgreSQL Shortcut for `SELECT * FROM`?
*Is there a shortcut to `SELECT FROM` in PostgreSQL? **
In the psql command line, various shortcuts simplify database interaction, such as d
for viewing table definitions and l
for listing databases. This question explores whether a similar shortcut exists to quickly execute SELECT * FROM
queries.
Answer:
Standard SQL provides a concise syntax for expressing SELECT * FROM
, namely TABLE 表名
. This shortcut is particularly useful in psql.
Usage and limitations:
Although the TABLE
syntax reduces the amount of typing, it can only be used in a specific query context. As stated in the documentation, "It can be used as a top-level command or as a space-saving syntax in... complex queries". Notably, it is compatible with clauses such as WITH
, UNION
and ORDER BY
, but not with WHERE
or aggregate functions.
The above is the detailed content of Is There a PostgreSQL Shortcut for `SELECT * FROM`?. For more information, please follow other related articles on the PHP Chinese website!