We are aware that PostgreSQL is one of the most popular and powerful databases in the market. Its amazing features and support from large developer communities always make a difference in the industry. Now, this blog is for you if you want to get familiar with the basic concepts of Postgre SQL. This blog will cover the basic CRUD operation (Create Read Update Delete) in Postgre SQL.

Postgre SQL CRUD Operations
Whenever we are using any system the major function that must be needed to be present is the operations like reading, writing, creating, and also being able to manipulate the schemas that store the data in that particular system. Similarly in a Postgre SQL database, we have CRUD operations.CRUD stands for Create, Read, Update and Delete operations. Whenever we want to manipulate data
CREATE Command in Postgre SQL :
In Postgre SQL, we can store data in the form of a table. A table consists of rows and columns. In CRUD ‘C’ stands for ‘CREATE’ whenever we want to create a table we can use CREATE TABLE command.
SYNTAX :



e.g. Let’s create a table named as employees which have five columns. This table store emp_id,first_name,last_name,birth_date and email of an employee.Then we can create this table using this query



SELECT Command in Postgre SQL :
Select is one of the most useful commands in PostgreSQL and it is used to read data from the database. It is one of the easiest commands in PostgreSQL.
SYNTAX :



Note: When we have a situation where we need to read data from every column of the Table then we can use * in the place of seelect_list
e.g. Let’s have a few situations where we can use this command
- Situation when we need whole data from the table (employees).
- When we need the data from particular column (say emp_id) from the table (employees)
- Situation when we need data from all the column of the table (employees) which follow the condition (like emp_id should be 1234).
- When we need the data of particular column (say emp_id) from the table(employees)which follow the condition (like emp_id should be 1234)
Let’s assume we are having the same table we had used for CREATE command.Then we can Read data from this table using this query.



UPDATE Command in Postgre SQL :
The UPDATE command is used to modify the existing data in the table. This command is very useful because most of the time we have to make changes in the existibg data.
Syntax :



e.g. Let’s assume we are having the same table we had used for CREATE command. So let’s have a situation where we need to change the first name of employees where employee id is ‘1234’.Then we can Update this table using this query



DELETE Command in Postgre SQL :
In Postgre SQL, the DELETE command is used to delete one or more rows from a table.
Syntax :



e.g. Let’s assume we are having the same table we had used for CREATE command. So let’s have a situation where we need to delete data of employees where employee id is ‘1234’.Then we can Delete this table using this query



Conclusion
So, in this blog, we’ve discussed the CRUD (Create Read Update Delete) Operation in Postgre SQL with the help of this blog, we can get familiar with the syntax of Create, Read, Update and Delete commands and e.g. will help us in getting a better idea of it.


