#import "Table.h"
@implementation Table
//1. Create a table between each column with ', ', if there is no create
CREATE TABLEif not exists t_class (
class_id Integer PRIMARY Key AutoIncrement,
Class_name varchar,
Person_count integerdefault 0)
//1.1// Delete a table
drop tableif exists T_person
//2. Insert data (increment), because the set ID is self-increment, so do not enter directly to 1
Insert into T_class (Class_name,person_count) VALUES (' Class1 ',ten)
//3. Deleting data (delete)
the All-deleted deleta from T_class in table
deletes the data for the specified id=5 delete from T_class where class_id=5
4. Modifying Data
Name all changed to newclassname update t_class set class_name=' Newclassname '
Modify a row of a data update t_class set class_name=' Newclassname ' where class_id=7
//5. Query data (check)
Query All select * from"T_class"
query specifies one or several data select Class_id,person_count from T_class where class_name=' oldname '
keyword and OR
Select Class_id,person_count from T_class where class_id=7 and person_count=
Select Class_id,person_count from T_class where class_id=7 or person_count=
Select Class_id,person_count from T_class where class_id between7 and
In -like does not need to check the primary key
select Class_id,person_count From T_class where Class_idin (7 , 9 ) // 7 and 9
Select Class_id,person_count from T_class where class_id notin (7,9)// absent 7 and the 9 of the
Select Class_id,person_count from T_class where class_name like' new% ' // with new Start
Select Class_id,person_count from T_class where class_name like'%class ' // with new End
// get the total number of data for a table alias name can be added after count(*)
Select COUNT (*) number from T_class//Count1 is in the first column to be counted, generally by the primary key column statistics generally write * can be
// Get minimum value
Select min (person_count) from T_class
// Get maximum value
Select min (person_count) from T_class
// get average
Select AVG (person_count) from T_class
// get Total
Select SUM (person_count) from T_class
// Get absolute Value
Select ABS (Person_count) from T_class
// without modifying the data, the query results are removed before and after the blank
Select Trim (class_name) from T_class
Replace
Select Replace (class_name,' C ',' O ') from T_class
// length ( space also count length )
Select Length (class_name) from T_class
// Date function
Select Date () from T_class
Select DateTime () from T_class
// judged to be empty
SELECT * from T_class where class_name is null
Sort
SELECT * from T_class ORDER BY class_id Desc(reverse)
SELECT * from T_class ORDER by class_id ASC ( Positive order,ASC can save default positive order )
@end
iOS UI Database SQLite Small database Add, delete, change, check, sort iOS UI database SQLite Small database Add, delete, change, check, sort iOS UI database SQLite Small database Add, delete, change, check, sort iOS UI database SQLite small database to increase, delete, change, check, sort iOS UI database SQLite Small database Add, delete, change, check, sort iOS UI database SQLite Small database of the increase, delete, change, check, sort, lightweight database, database is similar, to understand a other will be used
iOS UI database for SQLite small database Add, delete, change, check, sort