DEV Community

Ezhil Abinaya K
Ezhil Abinaya K

Posted on

PostgreSQL

PostgreSQL
PostgreSQL is a free open-source database system that supports both relational (SQL) and non-relational (JSON) queries.PostgreSQL is a back-end database for dynamic websites and web applications.In first postgreSQL name is Ingres --> Interactive Graphics and Research.
Installation

sudoapt update
Enter fullscreen mode Exit fullscreen mode

It is a command used in linux to install, update and mange software packages.sudo means superuser do, i.e., running a command with admin rights. apt means advanced package tool like playstore.

sudo apt install postgresql postgresql - contrib
Enter fullscreen mode Exit fullscreen mode

Check if postgreSQL is successfully installed. Open terminal then run these commands.

sudo -i -u postgres
Enter fullscreen mode Exit fullscreen mode

i means login shell, u means user.
\h means help
\l means list the database
\r means stop
Esc-shift-:q means quit
\c means connect
To see the postgres version

select version();
Enter fullscreen mode Exit fullscreen mode
select current-date;
Enter fullscreen mode Exit fullscreen mode
create table employee(empid integer,name varchar(25),designation varchar(25),dept varchar(25),salary integer();
Enter fullscreen mode Exit fullscreen mode
insert into employee values (123,'vasan','software developer','db',25000);
insert into employee values (124,'aadhi','software developer','AI',27000);
Enter fullscreen mode Exit fullscreen mode
select * from employee;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)