Ben Chuanlong Du's Blog

It is never too late to learn.

Ignore Nulls in the Analytical Window Function Lead in SQL

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

The analytical window function lead does not support ignoring NULL values. One workaround is to to use the analytical window fucntion first_value which supports ignoring NULL values.

first_value(my_col IGNORE NULLS …

Useful Rust Crates for Database

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Neon

Neon is a serverless open-source alternative to AWS Aurora Postgres. It separates storage and compute and substitutes the PostgreSQL storage layer by redistributing data across a cluster of nodes.

sqlx …

IDE for SQL

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Jupyter / JupyterLab

I personally prefer to query databases using a Jupyter/lab notebook. The reason is that results of queries are persisted in the notebook for future reference and sharing.

dbeaver …

Tips on ZetaSQL

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

ZetaSQL is a customized SQL dialect, along with parser and analyzer, that Google uses for products like BigQuery and Spanner.

unnest

cross join if an implicit join is used. Notice that …

SQL Style And Formatter

Command-line Tools

sleek

Sleek is a CLI tool for formatting SQL. It helps you maintain a consistent style across your SQL code, enhancing readability and productivity.

sqlfluff

The command sqlfluff fix can be used to fix issues (including formatting issues) in SQL code. It can be used as a tool to format SQL code. However, sqlfluff fix