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 can SQLite and ZFS be used together for software development?
- How to configure SQLite with XAMPP on Windows?
- How do I use the SQLite ZIP VFS to compress a database?
- How do I extract the year from a datetime value in SQLite?
- How can I get the year from a date in SQLite?
- How can I use SQLite to query for records between two specific dates?
- How do I generate a UUID in SQLite?
- How can I use SQLite with WPF?
- How can I use SQLite window functions in my software development project?
- How do I use UUIDs in SQLite?
See more codes...