본문 바로가기

Database/Greenplum

[Greenplum] ilike 를 이용하여 대소문자 구분없이 조회하기

728x90
반응형

환경정보

  • Greenplum 6.12(Postgresql 9.4 기반)

사전준비

drop table if exists public.test; 

create table public.test(
    no        serial       primary key
  , title     varchar(300) not null
  , memo      text         null
  , create_dt timestamp    default current_timestamp
)
distributed by (no);

insert into public.test
(title)
values
('abcdeFg'),('Ef');

select *
  from public.test;

 

like 구문을 이용하여 '%ef%' 를 조회하면 데이터가 조회되지 않는다.

 

하지만 ilike를 이용하면 데이터가 조회되는 것을 확인할 수 있다.

[Greenplum] ilike 조회

 

Postgresql 공식사이트, functions matching - like 부분을 잘보면(?) ilike 를 확인할 수 있을 것이다.

공식사이트 : https://www.postgresql.org/docs/9.4/functions-matching.html

 

Pattern Matching

There are three separate approaches to pattern matching provided by PostgreSQL: the traditional SQL LIKE operator, the more recent SIMILAR TO operator (added in SQL:1999), and POSIX-style regular expressions. Aside from the basic "does this string match th

www.postgresql.org

 

728x90
반응형