Sqlitestudio types of data

Asked

Viewed 1,846 times

1

I’m using Sqlitestudio to model a database. When creating the fields of a table, I noticed that it has some data types that do not appear in the Sqlite documentation. For example, in the combobox where we chose the type of the column, it has: BOOLEAN, DOUBLE, searched in the Sqlite documentation and did not find these types of data.

1 answer

3

The very documentation informs that it does not have boolean and informs that boolean values are stored as int, being false = 0 and true = 1:

1.1 Boolean Datatype

Sqlite does not have a Separate Boolean Storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).

Hence, you treat in your application when the value of this field is 0, it is false and when it’s 1, it’s true.

And when to the double, you can use real, which is also the recommendation of the documentation as set out in the table below:

inserir a descrição da imagem aqui

References:

Sqlite - Data Type

Datatypes In Sqlite Version 3

  • Opa, Diego. This I had already seen. My question is why the Sqlitestudio allows creating columns with these data types if Sqlite does not support. PRINTSCREEN

  • 1

    @Matheussaraiva he must do the conversions as described in the documentation, it is interesting you check what type of fields of the table, probably what you have selected Boolean, he created as int, and the double must be as real.

  • 2

    @Matheussaraiva actually your question is not the one you put in the comment. But if the intention is that it is, you can [Edit] the.

  • @Matheussaraiva In the answer image, "middle" column, shows the type of "affinity" (Affinity) column and if you consult the link SQLite - DataType of the answer, there explains why: "increase the compatibility of Sqlite with other Databases". It is not Sqlitestudio who "creates" these types

  • 1

    @Matheussaraiva You can’t put a direct link, but the phrase is right at the beginning of the item: 2.0 Type Affinity :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.