Skip to content

SQL Bits

You're here to find quick SQL recipes.

  • Home
  • Topics
    • Generic SQL
    • PostgreSQL
    • MariaDB
    • MySQL
    • Oracle
    • SQL Server
    • Db2
    • Informix
    • SQLite
  • Advertising
  • Write
  • About

Tag: level-beginner

Simple articles that can be understood by beginners, but can be useful to experts as well.

Informix: Select NULL explicitly

Sometimes we want to extract a literal value with a SELECT. This works perfectly fine if the literal value is 1 or 'a', but it fails with an error if the value is NULL. Let’s discuss why and how to solve the problem.

Continue reading Informix: Select NULL explicitly
Published August 21, 2021
Categorized as Informix Tagged level-beginner

Find Oracle version and edition

How to know Oracle edition and version number in use for this instance.

Continue reading Find Oracle version and edition
Published July 30, 2021
Categorized as Oracle Tagged level-beginner

Find texts starting, ending or containing a given string

How to select rows where a text column starts by, ends by, or contains a string. Including slightly less trivial cases.

Continue reading Find texts starting, ending or containing a given string
Published July 28, 2021
Categorized as Generic SQL, PostgreSQL Tagged level-beginner

Find out if you’re running MariaDB, MySQL or Percona Server

MariaDB and MySQL are mostly compatible, while Percona Server is basically MySQL with some optimisations. For this reason, it’s quite common for developers not being sure which of them they are using.

Continue reading Find out if you’re running MariaDB, MySQL or Percona Server
Published July 27, 2021
Categorized as MariaDB, MySQL Tagged level-beginner

MySQL: Find out which edition you are using

Sometimes, no one in a company knows how many databases they have, or how many commercial licenses they have. So you may be asked to write a report with all the existing MySQL instances, and whether they are Enterprise Editions or Community Editions.

Continue reading MySQL: Find out which edition you are using
Published July 27, 2021
Categorized as MySQL Tagged level-beginner

Find texts that contain HTML tags

How to select text values that contain HTML tags. How to disallow inserting texts that contain HTML tags.

Continue reading Find texts that contain HTML tags
Published July 26, 2021
Categorized as Generic SQL Tagged level-beginner

Find rows that (don’t) contain a value from a list

How to find rows that contain, or don’t contain, a value from a list. The list may be written in the query, or stored in a table.

Continue reading Find rows that (don’t) contain a value from a list
Published July 25, 2021
Categorized as Generic SQL Tagged level-beginner

Find the maximum text length in a column

How to get the length of the longest text in a column. Including Db2 specific syntax.

Continue reading Find the maximum text length in a column
Published July 24, 2021
Categorized as Db2, Generic SQL, Informix, MariaDB, Oracle, PostgreSQL, SQL Server Tagged level-beginner

Find invalid emails

How to select invalid email addresses from a column. How to reject attempts to insert invalid emails into a column.

Continue reading Find invalid emails
Published July 23, 2021
Categorized as Generic SQL Tagged level-beginner

Aggregate a column data

How to get statistical data from a column in standard SQL. In particular it shows how to get the minimum, maximum, average values, and the standard deviation.

Continue reading Aggregate a column data
Published July 22, 2021
Categorized as Generic SQL, SQLite Tagged level-beginner

Posts navigation

Newer posts Page 1 Page 2 Page 3 Older posts
  • Twitter
  • Email
SQL Bits
Proudly sponsored by Vettabase.