The end out of the above statement we illustrated by using the following screenshot. In the above example, we use to insert into a statement and we inserted 1 successfully. Now insert 1 by using insert into the statement as follows. In the above example, we use to insert into a statement and we inserted 0 successfully. So we successfully created a new table with Boolean data type and now perform insert operation on the table as follows. After that, we use the in a keyword to specify the Boolean values for the specified column here column name is a name. In the above example, we use a create table statement to create a new table name as a sample with a name attribute and see its data type we defined as Boolean with not null and check constraint as shown in the above statement. CREATE TABLE sample (name BOOLEAN NOT NULL CHECK (name IN (0, 1))) Now let’s see the different examples of Boolean type as follows. SQLite does not have any separate storage class for the Boolean type, so inserted all Boolean values stored as integer values that 0 and 1. In Boolean, it stores only two values so it requires a single bit to store the value. Actually, integer is one of the storage classes in SQLite and specifically it works on integer values. The integer store the numeric value as a signed number it either positive or negative but Boolean type only works on the positive values in form of 0 or 1. Basically, SQLite does not support the Boolean data type, so instead of Boolean type SQLite uses the integer data type to execute the Boolean expression in the form of true or false here 0 is used for false and 1 for true that we already discussed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |