Click "Add" to add the row_id to the Index Fields on the right. The Available Fields on the left contains the row_id we just created. In the following example, we create a table to store the user name and password of the user the database name "users", the table name "user_accounts", there are three columns: row_id INTEGER self-increasing type Primary key, usernameTEXT type is used to save the user name, passwordTEXT type is used to save the user password Create a tableĪt this time, we have entered the "design state", fill in the table name (user_accounts), click "Add", fill in "row_id" in the Name, Type select Integer, as shown below:īecause the row_id column is special, it is the primary key of our index, so click "Index", and you will see the following picture: Use SQLite expert to create a table and let it generate the required SQL statement for us Generally speaking, the free version is enough to meet our needs. ![]() SQLite expert is a simple and compact SQLite database management software, there are free version and paid version. You can use the graphical interface to analyze and modify etc. Moreover, the SQLite database itself is an independent file, which is easy to grab from the simulator. Therefore, it is best to write the SQL statement in a graphical environment first, and then test it before adding it to the code. Select * from user order by _id // Sort by id select * from user order by _id desc // Sort in reverse order of idįew people write SQL statements directly in the program, which is troublesome and error-prone. ![]() Desc // View table structure select * from // Query all changes select, from table // View the specified column select distinct, from table // Unique query insert into users(_id,username,password) select * from users // copy select username from users where username like ' S% ' // Non-renamed users with a capital S select username from users where username like ' _S% ' // Users whose third letter of the non-renamed name is capital S select * from users where _id in ( 001, 220, 230 )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |