コメント
-- ハイフンを2つ
データベース一覧
select * from pg_database;
テーブル名一覧
select relname as TABLE_NAME from pg_stat_user_tables;
テーブル内のカラム一覧
select
*
from
information_schema.columns
where
table_catalog='データベース名'
and
table_name='テーブル名'
order by ordinal_position;
レコードをクエリ
select
カラム名, ...
from
テーブル名
- 条件
where カラム名 比較演算子 値 比較演算子: =, >=, <=など
- timestamp型の場合
文字列をキャストする
where timestamp型のカラム名 >= cast('2020-01-20 14:00:00' as timestamp)
- 件数制限
limit 30;