change the data
In SQLite used update
to modify the data existing data, can where
range clause sets the modified constraint, without using where
clause constraint update
statement, modify the table corresponding to all types of data.
For example, Li Yi and Zhao Min in the following table both have a salary increase of 2000. At this time, we need to update the data in the table to 10000 and 12000 respectively. The wage data in the table can be modified through the update and where statements.
The implementation is as follows:
If you where
try without using clauses to restrict the modification conditions, you will find that all the wage values have been modified to the same value.
delete data
Use delete
statements in SQLite to delete existing data in the table. You can use where
clauses to set the scope of constraint modification. If you do not use where
clauses to constrain the delete
statement, all data of the corresponding type in the table will be modified.
For example, Zhao Min has resigned and needs to be deleted from the table. The realization is as follows:
Sort
Regarding sorting, order by
clauses and select
sentences are combined to achieve the sorting effect. Sorting is divided into descending order (DESC) and ascending order (ASC).
For example, we now sort by the wage value in descending order, as follows:
We also use where
clauses to restrict the sorted access, for example, now it is required that age>=25, and the wage value is in descending order, as follows: