These PostgreSQL Queries are the principal structures for recovering data from the database. And these PostgreSQL Queries contains pretend designs that is displayed from the database. Numerous database administration frameworks utilizes Structured Query Language as a basic design structures related to query. PostgreSQL Queries statements can be classified into the following types:
Insert
Select
Update
Delete
Insert
Description
By using insert command a new record can be inserted in the existing database table. i.e, inserting field value like emp_id, emp_name and salary can be inserted.
Steps for inserting values inside the database tables
Step - 1
In the SQLDB database, employee21 table has been created.
Step - 2
Right click on employee21 table and select Script followed by Create Script.
Step - 3
Employee21 table has been created.
Step - 4
Right click on employee21 table and select Script followed by Insert Script.
Step - 5
Column details will appear.
Step - 6
Enter first record details and click on execute.
Step - 7
Enter second record details and click on execute.
Step - 8
Enter third record details and click on execute.
Step - 9
Enter fourth record details and click on execute.
Step - 10
Click on employee21 table and select View Data followed by View top 100 rows.
Step - 11
It display all the employee details of employee21 table.
Select
Description
Select statement is used to retrieve a desire value from the database tables.
Steps for selecting the desire values from the database tables
Step - 1
In the SQLDB database, employee21 table has been created.
Step - 2
Right click on employee21 table and select Script followed by Select Script.
Step - 3
Display all the column name with the tablename and added where condition.
Step - 4
A specific employee records get displayed using select query.
Update
Description
By using update command, the column values can be updated.i.e, changing the name of the employee and increasing/decreasing the salary.
Steps for updating the values inside the database tables
Step - 1
In the SQLDB database, employee21 table has been created.
Step - 2
Right click on employee21 table and select script followed by Update script.
Step - 3
It display the below window.
Step - 4
Updating the dept name value.
Step - 5
Right click on employee21 table and select View Data followed by View top 100 rows.
Step - 6
Here the dept name has been updated.
Delete
Description
By using delete command one can delete the rows of an existing table based on the given condition.
Steps for deleting a specific record from the database tables
Step - 1
In the SQLDB database ,employee21 table has been created.
Step - 2
Right click on employee21 and select script followed by delete script.
Step - 3
A new window is appeared with some condition.
Step - 4
Deleting the employee record from the employee21 table.
Step - 5
Right click on employee21 table select View Data followed by View Top 100 Rows.
Step - 6
Details of employee with emp_id=1002 has been successfully remove.
Summary
Key Points
PostgreSQL Queries - Is a collection of variables of homogeneous data type.
Insert - Inserting the values inside the database tables.
Select - Retrieving a specific value from the database table.
Update - Updating the values from the database table.
Delete - Deleting a particular record from the database table.