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 troubleshoot a near syntax error when using SQLite?
- How can SQLite and ZFS be used together for software development?
- How do I use SQLite keywords to query a database?
- How do I use the SQLite ZIP VFS to compress a database?
- How do I call sqlitepcl.raw.setprovider() when using SQLite?
- How to configure SQLite with XAMPP on Windows?
- How do I use SQLite with Visual Studio?
- How do I use SQLite transactions?
- How do I write a SQLite query?
- How do I resolve an error "no such column" when using SQLite?
See more codes...