HAVING clause in PostgreSQL

PostgreSQL HAVING PostgreSQL HAVING clause is used to return the groups of rows only when the condition is TRUE. It is used with the PostgreSQL GROUP BY Clause. It, however, does not have a mandatory existence with the PostgreSQL GROUP BY Clause. Syntax: To group the rows by values in multiple columns. SELECT expressions FROM … Read more

GROUP BY in PostgreSQL

PostgreSQL GROUP BY PostgreSQL GROUP BY clause is used to collect data from multiple records and then to group the identical or similar results. It is used with the PostgreSQL SELECT statement. It, however, does not have a mandatory existence with the PostgreSQL SELECT statement. Syntax: To group the rows by values in multiple columns. … Read more

ORDER BY in PostgreSQL

PostgreSQL ORDER BY PostgreSQL ORDER BY clause is used to sort or re-arrange the records in the result set. It is used with the PostgreSQL SELECT statement. It however does not have a mandatory existence with the PostgreSQL SELECT statement. Syntax: SELECT expressions FROM table_name WHERE conditions; ORDER BY expression [ ASC | DESC ]; … Read more

WHERE clause in PostgreSQL

PostgreSQL WHERE The PostgreSQL WHERE clause is used with SELECT, INSERT, UPDATE and DELETE statements to return the result only when the condition is satisfied. Syntax: WHERE conditions; Example 1: Selecting specific fields from a table. Employment table: ID STATE RATE 1 A 60 2 B 70 3 C 65 4 D 80 5 E … Read more

DELETE Query in PostgreSQL

PostgreSQL DELETE To remove or delete existing records from a table, the PostgreSQL DELETE statement is used. Syntax: To delete all rows from a table. DELETE FROM table_name; Syntax: To delete specific rows from a table. DELETE FROM table_name WHERE conditions; DELETE statement using UI: Other than Query tool, we can also DELETE statement in … Read more

UPDATE Query in PostgreSQL

PostgreSQL UPDATE To update the existing records in a table one can use the UI or can use the PostgreSQL UPDATE statement. Syntax: UPDATE table_name SET column_1 = expr_1, column_2 = expr_2, … column_n = expr_n WHERE conditions; UPDATE statement using UI: Other than Query tool, we can also UPDATE statement in PostgreSQL using UI. … Read more

SELECT Query in PostgreSQL

PostgreSQL SELECT To fetch records from a table, one can use the UI or the PostgreSQL SELECT statement can be used. SELECT statement using UI:  Other than Query tool, we can also SELECT statement in PostgreSQL using UI. To SELECT statement using UI in PostgreSQL, follow the below steps. Right-click on the selected table. Move … Read more

INSERT Query in PostgreSQL

PostgreSQL INSERT To insert new records into a table the PostgreSQL INSERT statement is used. Syntax: INSERT into table_name(column_1, column_2, … column_n ) VALUES (value_1, value_2, .. value_n); Insert statement using UI: Other than Query tool, we can also INSERT statement in PostgreSQL using UI. To INSERT statement using UI in PostgreSQL, follow the below … Read more

PostgreSQL CREATE SCHEMA

CREATE SCHEMA Creating a schema using command: Syntax: CREATE SCHEMA name; Parameters: name: It is used to specify the name of the database to be created. Example: CREATE SCHEMA students;CREATE SCHEMA students; Explanation: A new schema will be created with the name ‘students’. Creating a schema using UI: To create a schema in PostgreSQL using … Read more

PostgreSQL DROP TABLE

DROP TABLE To drop or eliminate a particular PostgreSQL table, one can use the UI or can delete or remove the PostgreSQL table using the DROP TABLE command. Syntax: DROP TABLE name; Parameters: name: It is used to specify the name of the TABLE to be dropped. Example: DROP TABLE employment;DROP TABLE employment; Explanation: The … Read more