How to Create, Update, and Delete Database in Postgres
Md Enayetur Rahman

Md Enayetur Rahman @md_enayeturrahman_2560e3

About: Md Enayetur Rahman MERN Stack Developer | Next Js | Typescript | Framer Motion | Graph QL | Material UI | Aceternity UI |

Location:
Sylhet, Bangladesh.
Joined:
Jun 10, 2024

How to Create, Update, and Delete Database in Postgres

Publish Date: Oct 24 '24
0 0
  • Open SQL Shell.
  • Provide your username and password.
  • Type the following command
CREATE DATABASE your_database_name;
Enter fullscreen mode Exit fullscreen mode
  • If the database is created successfully you will see the "CREATE DATABASE" message.
  • Type the following command to see all the databases.
\l
Enter fullscreen mode Exit fullscreen mode
  • If you want to change the name of the database you can use the following command
ALTER DATABASE your_database_name RENAME TO new_database_name;
Enter fullscreen mode Exit fullscreen mode
  • If the database name is changed successfully you will see an "ALTER DATABASE" message.

  • If you want to delete the database you can use the following command

DROP DATABASE your_database_name;
Enter fullscreen mode Exit fullscreen mode
  • If the database deletes successfully you will see a "DROP DATABASE" message.

Comments 0 total

    Add comment