Skip to content

AWS bytes

  • Cheat Sheets
  • Concepts
    • Show All
    • S3 Concepts
  • How-To Guides
    • Show all
    • EC2
    • EBS
    • S3
    • Redshift
    • IAM
    • SQS
    • CloudWatch
    • Billing
  • CLI Guides
  • Contact Us
  • Tutorials
  • Interview Questions
  • Postgresql

Category: Postgresql

Postgresql

PostgreSQL – MIN Function

MIN function is an aggregate function that allows you to get the minimum of values. Example: Consider the employee table

Continue reading
Postgresql

PostgreSQL – MAX Function

MAX function is an aggregate function that allows you to get the maximum of values. Example: Consider the employee table

Continue reading
Postgresql

PostgreSQL – AVG (Average) Function

AVG function is an aggregate function that allows you to get the average of values. Example: Consider the employee table

Continue reading
Postgresql

PostgreSQL – Adding days to Date

In Postgres, you can query today’s date as below: SELECT current_date; To get tomorrow’s date, simply add 1 day to

Continue reading
Postgresql

PostgreSQL – Get Table Size

Use the below query to determine the size of a table in Postgres database: SELECT pg_size_pretty(pg_table_size(‘table_name’)); The below query gives

Continue reading
Postgresql

PostgreSQL – Escape single quote

You can escape the single quote character by making it a double single quote as shown below: Example: Insert into

Continue reading
Postgresql

PostgreSQL – How to call a function

In postgresql database, functions are called from within a select statement as shown below: SELECT function_name(function_arg1, function_arg2,…); Example: Below is

Continue reading
Postgresql

PostgreSQL – Extract date from timestamp

To extract date from timestamp field, you can simply use the date function as shown below; where timestamp_column is the

Continue reading
Postgresql

PostgreSQL – Switching between databases

You can connect to a different database from within the psql prompt using below command where databasename is the name

Continue reading
Postgresql

PostgreSQL – Get first row within each group

In Postgres database, you can use DISTINCT ON to select one row per group. Consider the below employee table; where

Continue reading

Posts pagination

«Previous Posts 1 2 3 4 … 10 Next Posts»
  • PostgreSQL Tutorials
  • Redshift Tutorials
WordPress Theme: Maxwell by ThemeZee.