Skip to content

Tag: mariadb

Get data from same row with MAX()?

[MariaDB 10.4, PHP8.0] How can I rewrite this so it works so it get weight_date from the row with MAX(total_weight) and list it AS highest_weight_date? I have read that we can’t use MAX() among with WHERE? I have tested to rewrite several examples, but I give up and embarrassed show my latest try: I try to add it to this

Can’t remove duplicates from MariaDB 10

I’m having hard time removing duplicates from database. It’s MariaDB (protocol version: 10, 10.3.34-MariaDB Server). I need to remove rows where three columns are equal. I was trying to use WITH clause but database throws error that it can’t recognize ‘WITH’, so I focused on traditional way. I need to remove rows where foreignId, column1 and column2 are equal. I’m

Why concatenation does not work in Dbeaver?

Using Dbeaver, the || concatenation does not work. Had to use CONCAT() instead. Got output error message: Truncated incorrect DOUBLE value. Anyone else had this issue? Skill level: Beginner Editor: Dbeaver OS: Windows 7 Answer MariaDB expects the PIPES_AS_CONCAT to be set with the sql_mode to use || as a concat operator. One can check what is set for sql_mode

How do I find the number of video games with more than 5 developers. (SQL query)

Lets say i have 2 tables which are videogames and developers. Under the videogames table, we have the following attributes: videogameid(PK) title dateOfRelease Under the developer table, we have attributes: developerid(PK) name position I tried finding the total number of videogames that had more than 5 developers. Here is my attempt to resolve the issue. While I did not get

Insert selected columns from one table to another SQL

I have two separate databases in the same host (localhost:3306). I have one table from the first database and a second from the other database. Here is 2 screenshots to become more clear I need to match: Is there any automatic way with a software? Need I to write some specific query to copy these 4 columns from one table

Get data from database and write it back in again

I have written a function by reading an excel file and writing it to the database. This works! Getting data from the database also works. Where I get stuck is at the point that the function should read each row, calculate it and write the result back to the database. I also want to find out how many rows were

How insert if a row not already exists ? (query)

My tables : Wrong migration script : I try insert new row if FirstTable.label == Str Test isn’t already exists but i get an error : SQL Error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ” at line 4 Update