Questions tagged [sqlite]

SQLite is an open-source software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world.

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.

SQLite is a relational database management system contained in a small (~350 KB) C programming library. In contrast to other database management systems, SQLite is not a separate process that is accessed from the client application, but an integral part of it.

SQLite is ACID-compliant and implements most of the SQL standard, using a dynamically and weakly typed SQL syntax that does not guarantee the domain integrity.

Making an MRE for SQLite questions on StackOverflow

Providing a minimal reproducible example for an SQLite-related question is most usefully and conveniently done by showing a few lines in SQLite syntax (i.e. some create table ... and insert ... which makes a tailored toy database with appropriate structure and sample data). Also consider making a db fiddle and sharing the link (there are multiple free such services out there; see, for example, this and this).

This way, potential answerers can easily recreate the database you used for demonstrating the problem and quickly and efficiently provide solution proposals that are supported by test runs and test output. Showing pictures of database viewers or table representations (even in ASCII art) does not provide the same benefits.

When seeking assistance with an SQL query, structure your query accordingly (see tips for asking a good SQL question).

If you already have created a database for demonstration purposes, consider using the .dump command of the SQLite commandline tool. It will automatically give you the lines for exactly recreating the database.

Getting familiar with the commandline tool also is a good way of avoiding all potential errors in whatever programming language is used to handle the database. With the commandline tool, you can inspect and analyse data and structure directly.

Mobile Apps

SQlite is commonly used to store data on Android, iOS, and Windows Phone apps since it has a simple implementation, easy to adapt, and quite fast.

Design

Unlike client-server database management systems, the SQLite engine has no standalone processes with which the application program communicates. Instead, the SQLite library is linked in and thus becomes an integral part of the application program.

The application program uses SQLite's functionality through simple function calls, which reduce latency in database access: function calls within a single process are more efficient than inter-process communication. SQLite stores the entire database as a single cross-platform file on a host machine.

References

Books

94030 questions
16
votes
3 answers

C# SQlite Connection String Format

I have a 2 part question here: I downloaded SQLite from SQLite Website and for .NET 4.5 there was a "mixed" mode version and a "non-mixed mode" version. How do I know which one I should use? When making a connection I use the following…
Kairan
  • 5,342
  • 27
  • 65
  • 104
16
votes
3 answers

Sharing sqlite database between multiple Android Activities

Can two or more Android Activities open an sqlite3 database for write? I have two Activities that need to insert data into the same sqlite database. When the second Activity calls SQLiteOpenHelper.getWriteableDatabase() an IllegalStateException is…
John in MD
  • 2,141
  • 5
  • 25
  • 36
16
votes
1 answer

Why is SQLite so slow (~2 q/s) on a specific machine?

On one of my servers (i7 Ivy Core, 32 GB RAM, Debian 6 @ 64bit, PHP 5.4.10) I experience extremely slow inserts with SQLite. The following test program reports just 2.2 inserts/second (14 seconds for inserting 30 rows). unlink("test.db"); $db = new…
Udo G
  • 12,572
  • 13
  • 56
  • 89
16
votes
2 answers

Proper use of callback function of sqlite3 in C++

I have the following C++ code for testing purposes in conjunction with SQLite3. It's a class called customer with a callback function declared. This callback function is called whenever sqlite3_exec() returns results (records) from the SQLite…
Michel de Man
  • 223
  • 1
  • 3
  • 10
16
votes
2 answers

SQLiteOpenHelper vs ContentProvider

I'm new to Android development. I'm trying to create an application that reads from the internal database (SQLite) and list all the data in a list (I'm using listView). So far I got a class called DatabaseHandler that extends SQLiteOpenHelper and…
André Alves
  • 6,535
  • 3
  • 17
  • 23
16
votes
7 answers

How do I get a list of indexed Columns for a given Table

Given a SQLite database, I need to get a list of what columns in a given Table are indexed, and the sort order. I need to do this from code (C#, though that shouldn't matter), so what I really need is a SQL statement, if one exists, that does…
ctacke
  • 66,480
  • 18
  • 94
  • 155
16
votes
1 answer

Deploying a Windows 8 Metro application that uses SQLite

Background We're using System Center 2012 to deploy a Windows 8 Metro-style application to Samsung slates in the field running Windows 8 Enterprise x64. The slates are joined to the domain and have a persistent DirectAccess connection back to it,…
George Durzi
  • 1,632
  • 1
  • 19
  • 31
16
votes
2 answers

SQLite: Get Total/Sum of Column

I am using SQLite and am trying to return the total of one column buy_price in the column TOTAL while at the same time returning all of the data. I do not want/need to group the data as I need to have the data in each returned row. id date …
user1650361
  • 163
  • 1
  • 1
  • 4
16
votes
5 answers

sqlite throwing a "String not recognized as a valid datetime"

I am playing around with Sqlite and keep getting an error when trying to read back some test data. For example, I created a simple db with a single table and some columns and populated it with some test data as shown below. sqlite> .schema CREATE…
Chaitanya
  • 5,203
  • 8
  • 36
  • 61
16
votes
2 answers

Is uninterruptible sleep the cause of my Python program being really slow (and if so, how can I solve this?)?

I have the following select statement (using sqlite3 and the pysqlite module): self.cursor.execute("SELECT precursor_id FROM MSMS_precursor "+ "JOIN spectrum ON spectrum_id = spectrum_spectrum_id "+ "WHERE spectrum_id = spectrum_spectrum_id "+ …
Niek de Klein
  • 8,524
  • 20
  • 72
  • 143
15
votes
3 answers

Using CursorLoader to query SQLite DB and populate AutoCompleteTextView

I have a SQLite database I would like to query. I want to target Android 2.2 through ICS. I came across this article on how to do this, but it uses deprecated code (does not query asynchronously, but on the UI thread). I've since read that I can use…
mraviator
  • 4,034
  • 9
  • 38
  • 51
15
votes
2 answers

Sqlite3 - Update table using Python code - syntax error near %s

This is my Python code - cursor.execute("""UPDATE tasks SET task_owner=%s,task_remaining_hours=%s, task_impediments=%s,task_notes=%s WHERE task_id=%s""", …
Sumod
  • 3,806
  • 9
  • 50
  • 69
15
votes
1 answer

SQLite: group_concat() multiple columns

I has a problem: In my SQLite (sqlite3 on android) database I have a table like so company | name | job -------------------------- 1 | 'Peter' | 'Manager' 1 | 'Jim' | (null) 2 | 'John' | 'CEO' 2 | 'Alex' |…
zapl
  • 63,179
  • 10
  • 123
  • 154
15
votes
3 answers

SQLite: what are the practical limits?

Before you mark this question as duplicate, PLEASE HEAR ME OUT!! I have already read the questions asked here on how to improve performance e.g. just to mention a few Improve INSERT-per-second performance of SQLite? and What are the performance…
WPFAbsoluteNewBie
  • 1,285
  • 2
  • 10
  • 21
15
votes
6 answers

Active Admin - refresh second drop down based on first drop down, Ruby on Rails

I am using Active Admin Gem on Ruby on Rails. I have a form in which i have selected category and sub category and then accordingly i have to fill the data. So i created two tables in sqlite added in active admin resouce. Every thing is working fine…
Astha
  • 1,728
  • 5
  • 17
  • 36
1 2 3
99
100