Structured Query Language (SQL) is a powerful and widely used language for managing and querying relational databases. One of the fundamental tasks in working with databases is retrieving and ...
There is a common myth about COUNT(1) and COUNT(*) that COUNT(1) is faster than COUNT(*), because the COUNT(*) query scans the whole table, but COUNT(1) does not. Let's check it out. First, we'll ...
これまで基本的なSQLやSQL JOINについて書きましたが、よく使われる複雑なクエリについて記載してなかったなと思ったのでこちらでまとめておきます。 クエリ結果から重複した値を除去したい場合にDISTINCTを使用します。 例えば、以下の従業員テーブルに ...