1. How do I create a self-added field?
2. What types of data are supported by SQLite?
3. Why can I insert a string into an integer field in the SQLite database?
4. Why SQLite think the expression ' 0 ' = ' 00 ' is true?
5. Why is SQLite not allowed to use ' 0 ' and ' 0.0 ' as the primary key for two different rows in the same table?
6. Why can't I read the SQLite database created in SPARCstation in Linux box?
7. Can multiple applications or multiple routines of the same application access the same database file at the same time?
8. Is the SQLite thread safe?
9. How do I list all the tables/indexes in a SQLite database?
Is there a known size limit for the SQLite database?
11. What is the maximum length of VARCHAR in the SQLite?
Does SQLite support BLOB types?
13. How do I add/remove fields from an existing SQLite datasheet?
14. I deleted a lot of data but the database file is not reduced, is it a Bug?
15. Is it possible to use SQLite for commercial purposes without having to pay royalties?
16. How do I use a string that contains single quotes (')?
What does the Sqlite_schema error represent?
18. Why does round (9.95,1) return 9.9 instead of 10.0? Isn't 9.95 supposed to carry up?
(1) How do I create a self-added field?
Simple answer: A field declared as an INTEGER PRIMARY KEY will automatically increase.
Here is the detailed answer: starting with the 2.3.4 version of SQLite, if you declare a field in a table to be an INTEGER PRIMARY KEY, then whenever you insert a null value into that field in the table, the null value is automatically replaced with the maximum number of rows for that field in the table. An integer with a large value of 1; If the table is empty, it will be replaced with 1. For example, suppose you have such a data table:
CREATE TABLE T1 (
A INTEGER PRIMARY KEY,
b INTEGER
);
In this data sheet, the statement
INSERT into T1 ValueS (null,123);
In the logical sense equivalent to:
INSERT into T1 ValueS (SELECT Max (a) from T1) +1,123);
A new API function Sqlite3_last_insert_rowid () returns the reshaping key for the most recent insert operation
Note that this integer key is always 1 larger than the last key inserted in the table before. The new key is unique relative to the existing key in the table, but it may overlap the key values previously deleted from the table. To always get the only key in the entire table, add the keyword AutoIncrement before the declaration of the integer PRIMARY key. This selected key will always be 1 larger than the maximum key already in the table. If a possible maximum key already exists in the table, the insert operation fails and returns a sqlite_full error code.
(2) What types of data are supported by SQLite?
See http://www.sqlite.org/datatype3.html.
(3) Why can I insert a string into an integer field in the SQLite database?
This is a feature, not a bug. You can put any information in any field without having to declare the type of the field. You can insert a string of any length into an integer field, or insert a floating-point number into a Boolean field, or insert a date into a character field. The data type you assign to this field in the CREATE TABLE command does not restrict the data that is inserted into this field. All fields can be inserted into strings of any length. However, the exception is for the INTEGER PRIMARY KEY field. This field can only hold a 64-bit integer, otherwise there will be an error.
But SQLite will default to the type of field you want to use to declare. So, for example, if you want to insert a string in a field declared as Integer, SQLite will attempt to convert it to an integer. If the conversion succeeds, the integer is inserted, otherwise the string is inserted, which is sometimes referred to as the type or column affinity.
Current 1/6 page
123456 Next read the full text