sqliteHow do I use boolean values in SQLite?
Boolean values can be used in SQLite to represent true or false values. Boolean values are represented in SQLite using the keywords TRUE
and FALSE
.
For example, the following code block can be used to select all records from the users
table where the active
column is set to TRUE
:
SELECT * FROM users WHERE active = TRUE;
This query will return all records from the users
table where the active
column is set to TRUE
.
The following code block can be used to update the active
column of the users
table:
UPDATE users SET active = FALSE WHERE id = 1;
This query will set the active
column of the user with id
1 to FALSE
.
The following code block can be used to insert a new record into the users
table:
INSERT INTO users (name, active) VALUES ('John', TRUE);
This query will add a new record to the users
table with a name
of John
and an active
value of TRUE
.
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 import data from a SQLite zip file?
- How can I use the XOR operator in a SQLite query?
- How do I use SQLite with Visual Studio?
- How do I use the SQLite VARCHAR data type?
- How can I use a SQLite viewer on Windows?
- How do I use SQLite VACUUM to reclaim disk space?
- How do I use the SQLite sequence feature?
- How do I use the SQLite round function?
See more codes...