PostgreSQL Schema Operations - Cheat Sheet Use the ALTER DATABASE statement with a SET clause to override the settings of a particular database: ALTER DATABASE db_nameĮxecute the ALTER DATABASE command with RESET option to rest the configuration parameter: ALTER DATABASE db_nameĮxecute the “\l” or “\l+” command from psql to show the list of databases: \l In place of “ option”, you can specify CONNECTION LIMIT, ALLOW_CONNECTIONS, or IS_TEMPLATE. For this purpose, you must use the below syntax: ALTER DATABASE db_name Using ALTER DATABASE command, you can modify the attributes of the database, such as connection limit, connections allowed, etc. The ALTER DATABASE statement allows us to change the default tablespace of a database: ALTER DATABASE db_name Use the following syntax to rename a database in Postgres: ALTER DATABASE old_db_name OWNER TO new_owner_name | current_user |current_role | session_user To change the database owner, users need to execute the ALTER DATABASE command as follows: ALTER DATABASE db_name This command allows us to change the database owner, rename the database, change database attributes, etc. Use the ALTER DATABASE command to modify a particular database in Postgres. The DROP DATABASE command allows us to delete/drop a particular database: DROP DATABASE db_name Specify the name of a database to be created in place of “db_name”.Įxecute the “ \c” command(from psql) followed by the database name to which you want to establish a connection: \c db_name To create a new database in Postgres, use the CREATE DATABASE command followed by the database name to be created: CREATE DATABASE db_name To do that, different commands are used in Postgres. In PostgreSQL, you can perform various database operations, such as create, alter, drop, etc. PostgreSQL Database Operations - Cheat Sheet So, let’s start with the database operations! PostgreSQL Users Operations - Cheat Sheet.PostgreSQL Table Operations - Cheat Sheet.PostgreSQL Schemas Operations - Cheat Sheet.PostgreSQL Database Operations - Cheat Sheet.This blog post will cover the basics of PostgreSQL concerning the below-listed concepts: Postgres offers various commands/statements to work with databases, schemas, tables, roles, etc. Due to its extensive features, Postgres has become most developers' first choice. It offers a variety of features, such as user-defined types, Point-in-time recovery, table inheritance, and many more. ![]() PostgreSQL is an advanced, open-source, highly stable relational database that extends the standard SQL language.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |