Skip to content
Advertisement

Tag: sqlite

How to set up sqlite to be local server (on lan)

Current situation : I have one GUI program(written by python) which using sqlite data stored on my computer. Wishlist: I would like to have one server computer to locate sqlite data (DATA A1) (CRUD operation needed) and ten more client computer using GUI program(written by python) which connect with the sqlite data (DATA A1) on lan. I have no idea

How do I select and count records less than 1 year old?

I’m using sqflite in my Flutter application. In this example, date is the actual date(10.06.2021) and DATUM is the datafield in the DB. I keep getting this syntax error: E/SQLiteLog(30657): (1) near “.2021”: syntax error in “SELECT COUNT (*) FROM Shisha_table WHERE (YEAR(10.06.2021) – YEAR(DATUM)) = 1” Answer There is no YEAR() function in SQLite. The logic of your code

SQLite Insert Distinct from 2 variables

I have a SQLite DB with a table with the following kind of data: What I need to do is take columns B and C, create a single unduplicated list and autoincrement the primary key for the unique values. It needs to check to make sure an entry is not already existing – so the second table would be: I

Query an AND in a many-to-many table

I know that this is a relatively simple question, I just can’t figure it out. I have three tables: people, presentations, and people_presentations. people and presentations both have ID columns, and people_presentations that has foreign keys to each of people and presentations. For example: people: presentations: people_presentations: I am trying to select all presentation IDs where a specific subset of

Select rows where the title contains any term from a list

I have a datset that has product_id, product_url, email, product_title, etc. I want to pull rows where product_title contains certain adjectives (Fabulous, Stunning, Rare, Amazing, Unique, etc etc. ) from a list of 400+ words. How do I do this without doing a separate select function for each word? I am using SQLite Answer You can construct a single query

Maintain order when using SQLite WHERE-clause and IN operator

Consider the following tbl: For reference, tbl looks like this: When issuing the following statement, the result will be ordered according to ID. However, I need the ordering to adhere to the order of the passed list of values. Here’s what I am looking for: Answer You can create a CTE that returns 2 columns: the values that you search

Insert into with Cursor.executemany and a Python list

Can someone please explain to me what is wrong with this code? I get the “parameters are of unsupported type” error. Is it not possible to feed a list into cursor.executemany? The type of the column is float not null. Answer The values for cursor.executemany must be a sequence of tuples: This is a logical extension of cursor.execute requiring a

How do I select rows that are not matched on specific column (sqlite)

Ok hopefully my table works, I’ve never posted here before, but I’m trying to find who has received doses of more than one type of vaccine from this table (all details are dummy data, not real people or id numbers etc) NHI_id fname lname vaccine_name vac_date 16120428 Clayton Marsh Comirnaty 2021-03-20 16120428 Clayton Marsh Janssen 2021-04-01 16120430 Dillon Richards Comirnaty

Advertisement