1. sqlite is of weak type. When creating a table, you can choose not to set the field type. Multiple types are used: integer, text, blob, and oc. NSNumber and NSString are supported, NSData2. you can set a field to a primary key and a unique key primary key. A table has only one primary key, and the unique key unique1) sqlite3data. db opens
1. sqlite is of weak type. When creating a table, you can choose not to set the field type. Multiple types are used: integer, text, blob, and oc. NSNumber, NSString, and NSData are supported. you can set a field to a primary key or a unique primary key. A table has only one primary key. The unique key unique 1) sqlite3 data. db opens
1. sqlite is of weak type. You can choose not to set the field type when creating a table. There are several types used: integer, text, blob, and oc that support NSNumber, NSString, and NSData.
2. You can set a field to a primary key or a unique key.
Primary Key. A table has only one primary key. The unique key is unique.
1) sqlite3 data. db open the database and create it if it does not exist
2) view the table in table. quit and exit.
3) create table students (id, name); create a table
However, statements used to create a table are generally written as follows: create table if not exists students (id, name );
Create table students (id integer primary, name text );
Create table students (id integer primary key auto increment, name text );
4) drop table students; delete a table
5) insert into students (id, name) values (1, 'hangzhou'); insert a statement
Insert into students (id) values (2); this is also acceptable, but the name will be NULL. If it is NULL, you can insert '';
Insert into students values (3, 'hangwei'); this is also acceptable, but all fields must be inserted;
6) delete from students; clear the table
Delete from students where id = 2; delete a row
Delete from students where id <2; delete
7) conditional Query
Select * from student;
Select name from student;
Select name from student where id = 2;
Select * from student limit 3;
Select * from student order by id;
Select * from student order by id asc; ascending, default
Select * from student order by id desc; descending order
Select * from student order by id desc limit 3; maximum three
Select count (id) from student;
Select sum (id) from student;
Select avg (id) from student;
Select * from student where id = 3 or id = 5;
8) modify
Update students set name = 'all' where id = 1;
9) copy a table
Create table students2 as select * from students;