Skip to content

Tag: sql

Sqlite3 in Python not fetching data

I have a sqlite3 DB with a few rows in it. When I try to fetch data from it in Python, fetchall returns an empty list. The data is being inserted in a different part of the project fine. I verified this by opening the DB in “DB Browser for SQLite” and running the following command. This returned t…

SQL combining tables to single rows

A problem with combining tables into single rows. TABLE GAMES: ID player1_ID player2_ID des 11 23 68 something 82 34 23 whatever 302 13 34 mmmmmmmm TABLE PLAYERS: ID alias 23 Jeex 34 Jack 68 Jill 13 John The key I start my query with is one of the Player ID’s. I want to show all the games that Player

Split text and digits by delimiter using regexp splitpart

From the table below I would like to split the config_json column into 2 columns as below The regex part of the code currently looks like this: However, there are some remains such as below: Thus, the formula above still needs to split by not just true,false or null, but also by digits or string. How can I fi…

Assign incremental id based on number series in ordered sql table

My table of interview candidates has three columns and looks like this (attempt is what I want to calculate): candidate_id interview_stage stage_reached_at attempt <- want to calculate 1 1 2019-01-01 1 1 2 2019-01-02 1 1 3 2019-01-03 1 1 1 2019-11-01 2 1 2 2019-11-02 2 1 1 2021-01-01 3 1 2 2021-01-02 3 1 3…