任何人都可以在postgresql中解释::含义吗?

San*_*eep -1 postgresql

我有下面的查询,它正常工作,但不知道::在postgresql中的含义和用法.

select (
    select ( 
        case when 1 > 0 then 1::float / (
            select count(id) from transactions_products where transaction_id in (
            select id from transactions_transactions tt 
            where status = 3 and fi = 355 
                and (invoice_date >= 1420754400) 
                and (invoice_date <= 1421099999) 
                and (tt.division_id = 107) 
                and (tt.department_id = 210) 
        ) and is_vehicle = 1 
    )::float else 0 end)
 limit 1) as f_4
Run Code Online (Sandbox Code Playgroud)

Jay*_*ard 7

::是PostgreSQL 的强制转换操作符.

  • CAST()也是标准SQL,适用于支持某种形式SQL的许多数据库. (2认同)