First, why use SQLite3, what is SQLite3, the common database can be used for mobile side?
1. There are several ways to persist storage:
1. plist can only store data for Nsdictionary and Nsarray. 2, Preference preference setting nsuserdefaults, easy to access, but only small data storage. 3, nscoding (nskeyedarchiver\nskeyedunarchiver) archive can store big data, but inconvenient to access, each storage will overwrite the last content. 4, SQLite3 focus, storage speed, and can store big data and take data more convenient, you can remove a single data. 5, Core Data is the encapsulation of SQLite3.
2, what is SQLite3, what are the advantages?
1) The advantages of SQLite SQLite is a lightweight embedded database It occupies a very low resource, in the embedded device, may only need hundreds of K of memory is enough to handle it faster than MySQL, PostgreSQL the two famous databases are also fast 2) what is a database? database is a warehouse database that organizes, stores, and manages data according to its structure, which can be divided into 2 kinds of relational database (mainstream) object type Database 3. What are the commonly used databases? Common relational database PC-side: Oracle, MySQL, SQL Server, Access, DB2, Sybase embedded \ Mobile Client: SQLITE4) How to store data in a database The storage structure of the database is like Excel, step 1 of storing data in a table (table) database . Create a new table (table) 2. Add multiple fields (column, columns, properties) 3. Add a multiline record (row , each row holds values for multiple fields)
Second, what can SQLite3 do?
1. What can SQLite3 do?
1, can store a large amount of data, and through multi-threading to ensure the security of access data, such as (with a new transaction, to solve the error in the middle of access to the solution). 2, can do offline cache, convenient for users in the absence of the network and the last time the information has been browsed, no need to request the network. 3, can do local fuzzy query, quickly realize the content of user query.
2. What are the commonly used graphical tools?
Navicat Premium graphical software is a database operating software on MAC systems
1) Open the SQLite3 database
2) Create a new database
3) graphical creation of tables
4) write the SQL statement manually
Third, how to use SQLite3?
1. SQL statements
The sentence code written in SQL language is the SQL statement in the process of running the program, in order to operate (to increase the deletion, CRUD) database data, SQL statements that must use SQL statements are not case-sensitive (for example, the database considers the user and user to be the same) and each statement must have a semicolon; The commonly used keywords in the end SQL are SELECT, INSERT, UPDATE, Delete, from, create, where, desc, order, by, Group, table, Alter, view, Index and so on database can not use keywords to name tables, fields
1) Data definition DDL
Data definition statements (ddl:data definition Language) include operations such as create and drop creating a new table in the database or deleting a table (CREATE table or drop table) operation Note: only Crete and drop You need to add table to the back, followed by the table name, and all other keywords need to be appended with the name.
2) Data manipulation DML
Data manipulation statements (Dml:data manipulation Language) include INSERT, UPDATE, Delete, and other operations above the 3 actions used to add, modify, delete data in the table
3) data Query Dql
The data query statement (dql:data query Language) can be used to query the data in the table to get the key select is DQL (also all SQL) uses the most operations other DQL commonly used keywords have where,order by,group By and having
Use of persistent storage---SQLite3