相关疑难解决方法(0)

在PostgreSQL中做什么?

::在网上看过各种涉及postgres代码的地方.例如:

SELECT '{apple,cherry apple, avocado}'::text[];
Run Code Online (Sandbox Code Playgroud)

这似乎是某种演员.::postgres 到底是什么时候应该使用它?

我尝试了一些谷歌搜索和搜索Postgres文档,::但没有得到很好的结果.
我尝试在Google中进行搜索:

  • postgres双结肠
  • postgres ::
  • ::

我在postgres文档搜索按钮中尝试了以下搜索

  • 双结肠
  • 双冒号演员
  • ::

问这个问题几乎令人尴尬,但我认为Google希望将来能够为其他人看到这个答案.

postgresql syntax types casting typecast-operator

62
推荐指数
2
解决办法
3万
查看次数

Postgres数据类型转换

我的数据库是Postgres 8.我需要将数据类型转换为另一个.这意味着,列数据类型之一是varchar并且需要intSELECT语句中将其转换为Postgres .

目前,我获取字符串值并将其转换int为Java.
有什么办法吗?示例代码将受到高度赞赏.

java sql postgresql casting

27
推荐指数
1
解决办法
4万
查看次数

如何在sqlite3中键入强制转换

我在命令提示符下运行了sqlite3并运行了一些基本的SQL命令.

user@comp:~$ sqlite3  
SQLite version 3.8.2 2013-12-06 14:53:30  
Enter ".help" for instructions  
Enter SQL statements terminated with a ";"  
sqlite> CREATE TABLE A (a int, b text, c float);  
sqlite> INSERT INTO A(a,b,c) VALUES (1, '2', 3);  
sqlite> SELECT b::int+2 FROM A;  
Run Code Online (Sandbox Code Playgroud)

除了最后一行之外,所有行都有效,它给出了错误:`

错误:无法识别的令牌:":"`

我正在阅读这个问题(SQL中的双冒号(:)标记,双冒号表示法是SQL的类型转换.我做错了吗?

sql sqlite casting

9
推荐指数
1
解决办法
2万
查看次数

postgres sql,date_trunc没有额外的零

这是我的SQL查询的摘录

SELECT
date_trunc(
    'day',
    to_timestamp(requests.date_created)
)AS DAY,
Run Code Online (Sandbox Code Playgroud)

这是我的输出 2013-02-04 00:00:00+00

我希望这只是公正的 2013-02-04

我如何获得理想的结果?

sql postgresql date date-format

4
推荐指数
2
解决办法
6753
查看次数

任何人都可以在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)

postgresql

-1
推荐指数
1
解决办法
694
查看次数