In one of our company's scripts I found a sqlite create table script that for one of the columns the data type definition is missing. What is the default value of a column type at the time of table creation?
create table x(
y,
z int
);
In the above simplified example y column is under question.
When I try to check the column with
pragma table_info(x)
the information for y column is missing.
Introduction to SQLite generated columns SQLite introduced the generated columns since version 3.31. 0. By definition, generated columns are the columns of a table whose values are derived from an expression that involves other columns of the same table. Generated columns are also known as computed columns.
SQLite only has four primitive data types: INTEGER, REAL, TEXT, and BLOB. APIs that return database values as an object will only ever return one of these four types.
You can declare a VARCHAR(10) and SQLite will be happy to store a 500-million character string there. And it will keep all 500-million characters intact. Your content is never truncated. SQLite understands the column type of "VARCHAR(N)" to be the same as "TEXT", regardless of the value of N.
Some Differences Between VARCHAR and TEXT The VAR in VARCHAR means that you can set the max size to anything between 1 and 65,535. TEXT fields have a fixed max size of 65,535 characters. A VARCHAR can be part of an index whereas a TEXT field requires you to specify a prefix length, which can be part of an index.
https://www.sqlite.org/datatype3.html
3.1. Determination Of Column Affinity
So we can assume that default type is a BLOB.
There are no types of a column only a type affinity. In the case it's omitted, the type affinity is NUMERIC
. You can read up on it here: https://www.sqlite.org/datatype3.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With