Skip to content

Tag: mariadb

MariaDB Created view takes too long

I have a problem. I have a table with 6 million records in it. Every record has a column dateTime, and for my code I need the most recent 16 records in ascending order. This took too long to query directly out of the original table, so I created a view using the following query: This means that the view

TypeError: Argument 2 must be Tuple or List

I have built a GUI using TKinter. There I want to output the stored data and change them individually. Using the UPDATE command, I want to update the data in the table. I use MariaDB as database. I’m getting this error: Here is the complete function: Any suggestions where I’m doing wrong? Answer A…

sql prevent double booking with trigger

I am stumbled on constructing a DB table for hotel reservations. In my reservation db, there is a reservation start_datetime and end_datetime attribute to indicate booked period and I tried to prevent double booking with a trigger statemen, but I am certain that this method would be vulnerable to race conditi…

How to select other rows in GROUP BY

Sorry for the bad title. I don’t know how to summarize it better. I have a table with unix timestamps and other values, like the following. time value 1620916380 110 1620916440 100 1620916500 120 1620916560 120 1620916660 90 The entries are always one minute apart. I want to group entries into 5-minute …

Find Latest Child Record (With Conditions) Per Parent Record

I have 2 tables with a parent/child hierarchy and am trying to pull the ID for the latest child record for each parent record, but also with conditions applied on the child record that is being pulled. Here’s what my tables look like: Now, let’s say I want to pull ID of latest QuizAttempt for each…

SQL DELETE FROM several tables

I have the following tables: dataset, links, files dataset has a field called tiComplete, if it is 0 then the record is incomplete, links and files both have a field “biDataset” that references the record in the dataset table. I’m trying to create a query that deletes all entries from datase…