227 questions
0
votes
0
answers
41
views
MySQL 8 fails to record binary session data in MEDIUMTEXT column
I have a table like this:
CREATE TABLE `sessions` (
`id` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`access` int unsigned DEFAULT NULL,
`data` mediumtext,
...
1
vote
2
answers
456
views
How to programmatically interact with both a MySQL 5 database and a MySQL 8 database from a single project?
My goal is to periodically sync data between two databases. One is a "new" database which runs MySQL 8, the other is an "old" database that hasn't been fully decommissioned yet ...
1
vote
3
answers
45
views
Combine 2 SELECTS in one result Side By Side
I have 2 selects that just get the SUM of IDs and are grouped by month.. I would like to have them only on 1 SELECT - side by side...
SELECT MONTH(data) AS month, COUNT(id) AS TOTAL
FROM numeracao
...
0
votes
1
answer
188
views
How to achieve simple subquery in peewee without join
I would like to have a simple subquery. One I would like to re-use in several places. Some of those would be joins, some would not.
SQL code would be like this
SELECT IF(x, y, z) as foo, table.*
...
1
vote
1
answer
36
views
SQL JOIN while concatenating data from subsequent rows
I'm having a hard time trying to puzzle together a query against an older MySQL 5.0 DB. The data model isn't optimal to begin with.
Data
ReceiptID
LineNbr
ProdNbr
Description
PrincipleDescription
...
-2
votes
1
answer
130
views
MySQL Leaderboard Table
I'm trying to figure out how to Select a specific number of rows from a MySQL table based on WHERE clause. I have a table with 10 dummy users, I want to get 2 previous and 2 next users of specific ...
0
votes
0
answers
109
views
Creating aggregated column in SQL with values depending on previous row - MySQL 5
I would like to get some help on the following query:
I have the following data frame I created with python pandas:
data = pd.DataFrame({'user_id':[1,1,1,2,2],'event':[1,0,1,1,0]})
The output is:
...
0
votes
3
answers
294
views
Sort records based on string
Please consider the table below
Id F1 F2
---------------------------
1 Nima a
2 Eli a
3 Arian a
4 Ava ...
0
votes
0
answers
179
views
rowcount and db size not same after migration from mysql 5 to mysql 8
I upgraded my database from mysql 5 to mysql 8.
After backup from mysql 5 and restore to mysql 8, the db size and the rowcount for table isn't same.
Is there any explanation why because the log show ...
0
votes
1
answer
1k
views
MySQL 5.7 recursive query on hierarchy data with unknown levels
I am developing a hierarchy data structure where I want to perform a recursion to get the desired output
id role_id reporting_to
------+-------------+-----------------
1 100 ...
0
votes
2
answers
4k
views
Error restore dump MySQL8 - ERROR 3552 (HY000) at line 19044: Access to system schema 'mysql' is rejected
We have a cron that does a full dump of the MySQL5 server, and in tests of restore on a empty instance, it restores all bases, including mysql with mysql.user carrying users and permissions together.
...
0
votes
1
answer
1k
views
docker-compose run mysql: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I'm totally roasted after working 14 hours straight, and even after crawling the whole internet I'm unable to resolve this problem.
The scene is imaginable simple:
I have a docker-compose.yml with ...
0
votes
2
answers
280
views
MYSQL View Query Performance Issue
I have 5 SQL tables
store
staff
departments
sold_items
staff_rating
I created a view that JOINs this four of the tables together. The last table (staff_rating),I want to get the rating column at a ...
0
votes
2
answers
108
views
MYSQL 5: Returning expression if statement is false, similar to NULLIF
I have a long complicated expression that refers to multiple tables. The expression returns a string, but i want to return a different string if the returned string was empty "".
With the IF ...
0
votes
1
answer
469
views
Getting MySQL error creating handler in an event
I'm trying to create an Event in MySQL 5.6 and I'm getting an error whenever I try to DECLARE something, like a parameter or handler:
SQL Error [1064] [42000]: You have an error in your SQL syntax; ...