Drizzle | SQL Toggle value
PostgreSQL
MySQL
SQLite
This guide assumes familiarity with:
- Get started with PostgreSQL, MySQL and SQLite
- Update statement
- Filters and not operator
- Boolean data type in MySQL and SQLite
To toggle a column value you can use update().set()
method like below:
Please note that there is no boolean type in MySQL and SQLite. MySQL uses tinyint(1). SQLite uses integers 0 (false) and 1 (true).