Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a shortcut for SELECT * FROM?

There are many useful shortcuts in psql console like \d or \l.
I wondering is there one for SELECT * FROM table_name?
I use this query often for learning purposes so it would be quite helpful not to have to write select * from ... all the time.

like image 845
user3616181 Avatar asked May 16 '15 13:05

user3616181


People also ask

What is the hotkey for select?

Press Ctrl+A on your keyboard to select all text in the document.

What is the shortcut key for select all objects?

Press SHIFT+TAB to select the object that you want. Press SHIFT+F10 for the shortcut menu.


1 Answers

There is a shortcut for SELECT * FROM in standard SQL, so you can use it in psql:

TABLE tablename;

This syntax shorthand can only be used with a limited range of clauses. The manual:

It can be used as a top-level command or as a space-saving syntax variant in parts of complex queries. Only the WITH, UNION, INTERSECT, EXCEPT, ORDER BY, LIMIT, OFFSET, FETCH and FOR locking clauses can be used with TABLE; the WHERE clause and any form of aggregation cannot be used.

like image 53
Erwin Brandstetter Avatar answered Sep 29 '22 10:09

Erwin Brandstetter