Converting a value into the “TEXT” data type in SQLite is helpful when you want to make sure the data isn’t accidentally treated as an integer or some other data type. Unlike most SQL database engines, SQLite uses a dynamic type system, which allows data to move between data types more easily. To convert data in an SQLite query to the “TEXT” type, you need to utilize the “CAST” expression, which explicitly defines a data type to use. $ sqlite3 mydb.db Replace “mydb.db” with the name of your database. A database with the specified name will be created if none already exists. $ sqlite3 my_db.db INSERT INTO my_table VALUES(CAST(97 AS TEXT)) Replace “my_table” with the name of your table. In the code, the number 97 is inserted into the table as a TEXT value. Writer Bio
