Double colon (::) notation in SQL

后端 未结 4 441
悲&欢浪女
悲&欢浪女 2020-11-28 11:17

Have picked up someone\'s code and this is a part of a where clause, anyone know what the double colon indicates?

b.date_completed >  a.dc::date + INTERVA         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 11:24

    It is a CAST operation(cast to a date type).

    Example:

    SELECT now()::timestamp(0);

    Is equivalent to:

    SELECT 
        CAST (now() AS timestamp(0));
    

    They both result in casting now() to timestamp in the following format: YYYY-MM-DD HH:MM:SS

提交回复
热议问题