Answer the question
In order to leave comments, you need to log in
How to name the data structure, in Russian, due to which the query in sqlite will be executed faster?
Hello, I'm going through an online quest for android developers https://contest.yandex.ru/droid_mission
I can't solve the problem :)
Task: On a
quiet Friday evening, two agents stay late and have an insoluble argument. They were instructed to store a large amount of secret data in a Sqlite database with an integer key key.
Agent A creates a table with a query like:
CREATE TABLE t(key INT PRIMARY KEY, secret_value_1, secret_value_2)
, and agent B - with a request of the formCREATE TABLE t(key INTEGER PRIMARY KEY ASC, secret_value_1, secret_value_2)
. Answer the question
In order to leave comments, you need to log in
1. "ROWID"
https://sqlite.org/lang_createtable.html#rowid
2. "auto-increment"
https://www.sqlite.org/datatypes.html
One exception to the typelessness of SQLite is a column whose type is INTEGER PRIMARY KEY. (And you must use "INTEGER" not "INT". A column of type INT PRIMARY KEY is typeless just like any other.)
INTEGER PRIMARY KEY columns can be used to implement the equivalent of AUTOINCREMENT. If you try to insert a NULL into an INTEGER PRIMARY KEY column, the column will actually be filled with an integer that is one greater than the largest key already in the table.
SELECT MAX(key) + 1 FROM t
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question