MySQL – Regular expression replace

As of MySQL 8.0 and MariaDB 10 we can use  native REGEXP_REPLACE function. See also See MariaDB docs and PCRE Regular expression enhancements. — REGEXP_REPLACE(col, regexp, replace) SELECT REGEXP_REPLACE(“stackoverflow”,...

Mysql utf8_general_ci vs utf8_unicode_ci

Why to use utf8_unicode_ci over utf8_general_ci, or simple why never not to use utf8_general_ci. Basically utf8_general_ci is a broken version of utf8_unicode_ci. It is slightly faster bit only a little bit and it can produce unexpected result while sorting or...

MySQL (MariaDB) – Appointment Database Schema

Database Schema under revision: codreview: https://codereview.stackexchange.com/questions/263965/appointment-database-design-ii github: https://github.com/DevWL/Appointment-DB Query database: DROP DATABASE IF EXISTS bookings; CREATE DATABASE bookings CHARACTER SET =...

PrestaShop SQL useful Reports

Report 1 – Query sum of the products sold each month for each category in PrestaShop. Prestashop tabels: [ps_order_detail], [ps_orders], [ps_product], [ps_order_history] Combine aggregation function such as COCNAT and YEAR and DATE with multiple GROUP BY...