- Client: DataGrip
- Database engine: PostgreSQL
To change the use of a database, you can do it by:
- From the Terminal (IDE or SO) with psql
- Through UI with pgAdmin4 (Query Tool) or IDE
Change the database through UI with the IDE
You can delete the disused consoles as follows:
- Files (Right side panel of the IDE) >
- Scratches and Consoles >
- Database Consoles >
- Select the directory PostgreSQL - @localhost (Name of Project Data Source) >
- Delete disused consoles with right click and delete.
Select a database to perform sql queries:
- Database (Left side panel of the IDE) >
- Double Click on PostgreSQL - @localhost >
- Double Click on the name of the database >
- Right click on
public schema
>
- New >
- Console
In this way in the directory Files> Scratches and Consoles > Database Consoles > PostgreSQL - @localhost, a new console positioned in said database was added.
Finally, you can operate with DDL (create, alter, drop) or DML (insert, update, delete, select).
CREATE TABLE test_2 (test int);
TABLE test_2;
Quick tip: With the cursor positioned within the source code and ctrl+enter the sql queries are executed in the IDE.
GL