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 calledtestwith two columns:idandis_active.INTEGER PRIMARY KEY: This specifies that theidcolumn is an integer and is the primary key of the table.BOOL: This specifies that theis_activecolumn is of type bool.INSERT INTO: This statement inserts a value oftrueinto theis_activecolumn of thetesttable.SELECT *: This statement retrieves all the data from thetesttable.
Helpful links
More of Sqlite
- How do I use SQLite to retrieve data from a specific year?
- How do I use SQLite with Zephyr?
- How to configure SQLite with XAMPP on Windows?
- How do I use SQLite with Visual Studio?
- How do I use the SQLite ZIP VFS to compress a database?
- How can I use SQLite with WPF?
- How do I use the SQLite zfill function?
- How do I format a date in SQLite using the YYYYMMDD format?
- How do I use the SQLite VARCHAR data type?
- How do I use an SQLite UPDATE statement with a SELECT query?
See more codes...