Different databases support different ways to get the first and last day of the month. Let’s see how to do it in MariaDB and MySQL.
Category: MariaDB
MariaDB CRUD operations Hello World
Let’s see a slightly elaborated “Hello world”, to demonstrate the most common SQL operations with MariaDB: creating a database and a table, inserting a row, reading it, modifying it, deleting it.
MariaDB: Rollback the transaction if a warning occurs
In MariaDB most errors cause the current transaction to rollback, but warnings don’t. This article shows how to rollback when a warning happens.
Copying tables in MariaDB and MySQL
There are many reasons why we may want to duplicate a table. We may want to copy the table structure alone, or include the rows, we may only want to copy some sample rows. Let’s see how to copy a table in MariaDB and MySQL.
MariaDB: Running a prepared statement in a stored procedure
How to run prepared statements in a MariaDB stored procedure. The article covers one-off prepared statements, reusable prepared statements, and parameters.
MariaDB/MySQL: Comments on database objects
MariaDB and MySQL support a non-standard syntax to read and write comments for database objects.
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.
Find the maximum text length in a column
How to get the length of the longest text in a column. Including Db2 specific syntax.
Create a cross-table unique ID
Most tables are created with a unique, progressive ID. But how to create an ID whose values are unique across multiple tables? For example, if value 1 is in table A, it must not be in table B.
MariaDB: Select the Fibonacci series
How to select the first N numbers from the Fibonacci series, or the Nth number from the series. This is done by using the SEQUENCE
storage engine and user variables.