SQL

Query if a string is in a list

select name, 
    from my.table
where name IN ('jon', 'mary')

Query within a timestamp

select record
    from my.table
where
    created > timestamp '2019-10-01 00:00' AND
    created < timestamp '2019-10-01 23:59'

Creating temporary table

with my_new_table as (
  -- something here
  select *
  from another.table
)

select *
from my_new_table

String comparison

select
    *
from my_table
where my_table.items LIKE '%something%'
limit 10

Search for empty or null strings

where (surname is null or surname = '')

Cheers!
Letícia

Comments