Skip to content
Advertisement

Tag: mariadb

Conditional UPDATE MariaDB (MySQL)

Code: UPDATE COMPANY SET id=’21’ WHERE id=’20’; Error: SQLException: Duplicate entry ’21’ for key ‘PRIMARY’ I want to UPDATE the primary key field in this case it’s called ‘id’ to another value …

Update every 5 minutes a value

I am using a MySql DataBase and I want to know if there are any methods to modify a value of a column every x minutes/hours/days. For example, I want to execute the following query every 5 minutes, UPDATE table SET x=0;. Could I set an event or something like this from the PHPMyAdmin interface? Answer I’m not aware about

How to get a COUNT() value when GROUP BY has no row?

RDMS : MariaDB 10.1.23 MCRE : SQLFiddle: http://sqlfiddle.com/#!9/f32a01/1 Consider the following query : Without the GROUP BY clause, I know that COUNT() will return 0 if no row match the query. I also know that, if my GROUP BY “fails” (If i have no row to group by, in my example, if no row satisfy e.created_at > CURRENT_DATE – INTERVAL

SQL Query with REGEXP to change URL strings dynamically

My DB table named “post” does look as follows So not every message row does contain an url and not every message with a [LINK]-tag does contain a proper url. Also there are enrties which have a longer ID, they should not be changed. Now i have to change every entry which has an ID length between 4 and 5

How to tell MariaDB/MySQL that a column is unique due to HAVING clause

With ONLY_FULL_GROUP_BY set (which I don’t want to/can’t change) the following query errors with ERROR 1055 (42000): ‘dbname.test1.person_id’ isn’t in GROUP BY (or equivalent longer message in mariadb). How can I “tell” MySQL that I know the person_id is unambiguous because of the HAVING clause? I don’t want to use ANY_VALUE because that isn’t available in all the dbs where

Advertisement