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 – Change Column datatype

Below is the syntax to change the data type of a column. tablename is the name of the table, columnname

Continue reading
Postgresql

PostgreSQL – Count distinct over multiple columns

Sql statement to get the count of distinct values in a column: SELECT COUNT (DISTINCT col1) FROM table1; Below is

Continue reading
Postgresql

PostgreSQL – Renaming a Column

Below is the syntax to rename a column in Postgres where tablename is the name of the table and columnname

Continue reading
Postgresql

PostgreSQL – Change Table Owner

Below is the syntax to change the owner of a table in Postgres database: Alter table schemaname.tablename owner to new_owner;

Continue reading
Postgresql

PostgreSQL – Drop User

Below is the syntax to delete a database user in postgres. DROP USER rolename; DROP ROLE rolename; Both the above

Continue reading
Postgresql

Postgresql – How to get current day, month, year from date

Run the below command to get current day, month and year from date in postgres database. Sql query to view

Continue reading
Postgresql

PostgreSQL – Get current value and next value of a Sequence

Postgres provides currval and nextval functions for sequence manipulation. currval function returns the current value of the sequence without advancing

Continue reading
Postgresql

PostgreSQL – Drop Column

Syntax to drop a column in postgres database: ALTER TABLE tablename DROP COLUMN columnname;

Continue reading
Postgresql

PostgreSQL – Get current user

Run the below select statement to obtain the username of the current session in Postgres database. select current_user;

Continue reading
Postgresql

PostgreSQL – Get current database name

Run the below command to check the current database you are connected to in Postgres. SELECT current_database();

Continue reading

Posts pagination

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