SQL (PostgreSQL Variant)
date_part(field, source)
- Get the component of a
date
- date_part was a Postgresql-specific wrapper around the SQL standard
extract()
. Starting with PostgreSQL 14,EXTRACT()
was changed to return typenumeric
instead offloat8
to avoid loss-of-precision issues (See StackOverflow and PostgreSQL 14.0 Release Notes - See Neon PostgreSQL Tutorial: DATE_PART() Function
- Get the component of a
alter table table_name rename to new_table_name;
- Rename a table
- See Neon PostgreSQL Tutorial:PostgreSQL Rename Table
agg_func(<expr>) FILTER (WHERE <condition>)
- Aggregate values which match a condition
- Could also be done with a
case
statement - Crunchy Data: Using Postgres FILTER
To Add: - Using - Distinct on