Skip to content

Jean-Pierre Lambelet

Il n'y a pas de questions bêtes

  • Programming tips
  • General tips
  • About
  • EN
    • FR
    • EN

SQL

PostgreSQL – How to filter on a column with uppercase letters in its name

April 30, 2026 by Jean-Pierre Lambelet
Baie de serveurs illuminée illustrant une base de données PostgreSQL avec colonnes en majuscule

On PostgreSQL, a column whose name contains an uppercase letter must be wrapped in double quotes to be read or modified. Syntax and best practice to avoid this common pitfall.

Categories SQL

SQL – How to retrieve entries before and after an ID

August 17, 2026October 21, 2013 by Jean-Pierre Lambelet
MacBook avec code sur un bureau

It is possible, for example in the context of a competition, that we are looking to find out what are the 5 best scores preceding the one I just made. To do it in SQL, although a little tricky, it is not too complicated. The 5 before me SELECT * FROM scores WHERE score > … Read more

Categories SQL

SQL – how to change the ORDER BY in a query

August 17, 2026August 13, 2013 by Jean-Pierre Lambelet
MacBook avec code sur un bureau

When it is necessary to have a predefined order in a query, it is possible to change the order of the items by using a CASE in the ORDER BY. In this example id 12 must appear before id 2. SELECT * FROM channel ORDER BY ( CASE WHEN id = 1 THEN 1 WHEN … Read more

Categories SQL

À propos

Jean-Pierre Lambelet est un développeur web suisse. Ce blog rassemble ses astuces et tutoriels sur PHP, Symfony, Drupal, Docker et l'outillage de développement front-end.

Recent Posts

  • Stopping a RAG chatbot from presenting stale information as current
  • Giving a chatbot live weather through LLM tool calling
  • RAG explained to my mum
  • A Chrome extension to find unanswered WhatsApp chats
  • LLM – System prompt – Prevent contact hallucination with a registry
  • FR
  • EN

Recent Posts

  • Stopping a RAG chatbot from presenting stale information as current
  • Giving a chatbot live weather through LLM tool calling
  • RAG explained to my mum
© 2026 Jean-Pierre Lambelet • RSS feed • Privacy Policy • Ads fund this blog,