*Shortcut for `SELECT FROM` in psql**
psql provides many convenient shortcuts, such as d
and l
. But is there a dedicated shortcut for the commonly used query SELECT * FROM table_name
?
The answer is yes, in standard SQL there is a shorthand form for this query:
<code class="language-sql">TABLE tablename;</code>
However, this syntax can only be used in a limited number of clauses. According to the manual:
It can be used as a top-level command or as a space-saving syntax variant for parts of complex queries. Only the WITH, UNION, INTERSECT, EXCEPT, ORDER BY, LIMIT, OFFSET, FETCH, and FOR locking clauses can be used with TABLE; neither the WHERE clause nor any form of aggregation can be used.
The above is the detailed content of Is There a Shortcut for `SELECT * FROM table_name` in psql?. For more information, please follow other related articles on the PHP Chinese website!