【发布时间】:2022-01-15 13:15:11
【问题描述】:
这是一个 Postgres SQL 问题。
我有一个用户定义的数据类型如下。
create type my_type as (name varchar(100), credit_points double precision)
我有一个使用上述类型作为列数据类型的表,如下所示。
create table tab1 (
id serial,
name_credit my_type
)
我可以使用下面的插入语句将值插入到这个表中。
insert into tab1 (name_credit) values(('santhosh', 101.75)::my_type)
现在,我想访问下表。
select * from tab1 where name_credit[2] between 100.0 and 110.0
或
select * from tab1 where name_credit.credit_points between 100.0 and 110.0
但这两种方法都不适合我。请问有什么想法吗?
【问题讨论】:
标签: postgresql