Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to postgresql-- operator

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Postgresql has a wealth of internal operators, which can be divided into four main categories: arithmetic operators, comparison operators, logical operators, and bit operation operators. As follows:

①: arithmetic operator:

Used for all kinds of numerical operations, including addition (+) minus (-) multiplication (*) division (/) to find the remainder (%)

Example:

Testdb=# create table emp (num int)

Testdb=# insert into emp values (60)

Testdb=# select num,num+10,num-10,num+10-5 numb 10.5 from emp;-add and subtract the field

Num |? column? |? column?

-+-

60 | 70 | 50 | 65 | 70.5

(1 row)

Testdb=# select num,num*2,num/3,num%2 from emp;-perform multiplication and division on fields

Num |? column? |? column? |? column?

-+-

60 | 120 | 20 | 0

(1 row)

②: comparison operator

Used for comparison operations, including greater than (>) less than (=) less than or equal to (

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report