PostgreSQL Expression are the sequences of multiple esteems, operations and PostgreSQL capacities that assess through a quality.PostgreSQL Expression are resemble equations that are composed in query dialect. And these PostgreSQL Expression will get utilize to queries that database consisting for particular arrangement of information.
Syntax
The syntax for PostgreSQL Expression is as follows:
Select <column1><column2>,<columnN>from <table_name> where
[Condition|Expression];
Table_name => Any accurate table in the database.
Column_name => The columns that are inserted in the table.
Expression types
Description
And the expression in postgreSQL can be classified into 2 types
PostgreSQL Boolean Expressions
PostgreSQL Numeric Expressions
PostgreSQL Boolean Expressions
Description
PostgreSQL Boolean Expressions bring the information on the premise of coordinating individual esteems.
Syntax
Select <column1><column2>,<columnN>from <table_name> where single value watching value matching Expression.
Table_name =>Any accurate table in the database.
Column_name =>The columns that are inserted in the table.
Examples
By viewing the below example the concept of PostgreSQL Boolean Expressions can be easily understands.
[c]
SQLDB=# select * from Employee;
id | name | age | address | salary
----+-------+-----+-----------+--------
1 | Paul | 32 | California| 20000
2 | Allen | 25 | Texas | 15000
3 | Teddy | 23 | Norway | 20000
4 | Mark | 25 | Rich-Mond | 65000
5 | David | 27 | Texas | 85000
6 | Kim | 22 | South-Hall| 45000
7 | James | 24 | Houston | 10000
(7 rows)
SQLDB=# SELECT * FROM Employee WHERE SALARY = 10000;
id | name | age | address | salary
----+-------+-----+----------+--------
7 | James | 24 | Houston | 10000
(1 row)
[/c]
Here in the above example,out of 7 rows in the table,we can retrieve only selected row based on where condition.
PostgreSQL Numeric Expressions
Description
PostgreSQL Numeric Expressions performs mathematical operations on entire table records.
Syntax
Select numerical_expression as operation_name from <table_name> where condition;
Table_name =>Any accurate table in the database.
Column_name =>The columns that are inserted in the table.
Examples
By viewing the below example the concept of PostgreSQL Numeric Expressions can be easily understands.
[c]
Sampledb=# SELECT (15 + 6) AS ADDITION ;
addition
----------
21
(1 row)
[/c]
Here in the above example, performing addition on two numbers which defines the result set.
Summary
Key Points
PostgreSQL Expressions - Are written query dialect.
PostgreSQL Boolean Expressions - Gives the information on individual esteems.