Commonly used commands include \l, \d, \d5, \di, \ds, \dv, \df, \dn, \db, \dg, \dp, \c, \pset, show search_path , ALTER TABLE, INSERT INTO, UPDATE, DELETE FROM, SELECT, etc. Detailed introduction: 1. \l: used to view all databases, templates, etc. on the server; 2. \d: used to view all data tables in the specified database; 3. \d5, etc.
Operating system for this tutorial: Windows 10 system, Dell G3 computer.
In PostgreSQL, some commonly used commands are as follows:
- \l: Used to view all databases, templates, etc. on the server.
- \d: Used to view all data tables in the specified database.
- \d5: Used to view table details, including size, comments, etc.
- \di: used to view the index.
- \ds: used to view sequences.
- \dv: used to view the view.
- \df: used to view functions.
- \dn: Used to view all schemas in the specified database.
- \db: used to view all table spaces.
- \dg or \du: used to view all roles or users.
- \dp or \z: Permission assignment for viewing the table.
- \c: used to switch databases.
- \pset: used to set the output format.
- show search_path: used to display the current search path.
- ALTER TABLE: used to modify the data table structure, such as adding, deleting, modifying fields, etc.
- INSERT INTO: used to insert data into the data table.
- UPDATE: used to update existing data in the data table.
- DELETE FROM: used to delete data from the data table.
- SELECT: used to query data from the data table.
These commands can help you with daily data management and query operations, but please note that these are not all commands and functions in PostgreSQL. It is recommended to refer to official documents or related tutorials for more comprehensive information. information.
The above is the detailed content of What are the commonly used commands in postgresql?. For more information, please follow other related articles on the PHP Chinese website!