sqliteHow do I use the SQLite bool type?
The SQLite bool type is a storage class used to store either a 0 (false) or 1 (true). It is used to store boolean values in an SQLite database.
Example code
CREATE TABLE test (
id INTEGER PRIMARY KEY,
is_active BOOL
);
INSERT INTO test (is_active) VALUES (true);
SELECT * FROM test;
Output example
id | is_active
----+-----------
1 | 1
CREATE TABLE
: This statement creates a table calledtest
with two columns:id
andis_active
.INTEGER PRIMARY KEY
: This specifies that theid
column is an integer and is the primary key of the table.BOOL
: This specifies that theis_active
column is of type bool.INSERT INTO
: This statement inserts a value oftrue
into theis_active
column of thetest
table.SELECT *
: This statement retrieves all the data from thetest
table.
Helpful links
More of Sqlite
- How to configure SQLite with XAMPP on Windows?
- How can I use an upsert statement to update data in a SQLite database?
- How do I use SQLite with Visual Studio?
- How do I install SQLite on Windows?
- How do I use SQLite UNION to combine multiple SELECT queries?
- How do I use variables in a SQLite database?
- How do I show the databases in SQLite?
- How do I use regular expressions to query a SQLite database?
- How do I install and use SQLite on Ubuntu?
- How do I set up an ODBC driver to connect to an SQLite database?
See more codes...