Lynn's Dev Blog
  • About
  • Rails
  • Ruby
  • Experience
Sign in Subscribe

PostgreSQL

A collection of 2 posts
TIL: How to turn on the expanded table formatting mode in PostgreSQL
experience

TIL: How to turn on the expanded table formatting mode in PostgreSQL

Note: The following was tested with PostgreSQL 13.1 Default setting: \x off $ psql myblog_dev myblog_dev=# SELECT "users".* FROM "users" WHERE "users"."role" = 10 LIMIT 1; The output format would be: It was difficult to read the result. Turn on the expanded table formatting mode by \x on.
Dec 1, 2021 2 min read
When ORDER BY and NULL work together
experience

When ORDER BY and NULL work together

When we would like to sort the result-set in ascending or descending, we can use ORDER BY in SQL query. In Rails, we can use order which is derived from ActiveRecord::QueryMethods. For example, Article.all.order(published_at: :desc) Let's focus on the published_at attribute now. > What will
Sep 3, 2021 4 min read
Page 1 of 1
Lynn's Dev Blog © 2023
Powered by Ghost