The operation of the record, mainly to increase, delete, change, check
First, record insertion
Command:insert into table name (column name, column name, ...) values (value, value, ....);
The number of values should be the same as the number of columns, Value and column order, value type and column field type match
When the column name is omitted after the table name, values for all columns are given later in values
When inserting data, the string adds single quotation marks "'----character and date data should be enclosed in single quotes
Chinese garbled problem when inserting data: Set client's encoding set to GBK
Modify the MySQL configuration file to permanently change the client encoding set-----Mysql/my.ini
[MySQL]----client configuration
[MYSQLD]----Server-side configuration
Second, record deletion
Command:delete from table name where conditional statement; (Delete records that meet the criteria in the table, and delete all records in the table if the WHERE Condition statement is omitted)
Delete a table all records: truncate table name; effect and delete from table name;
Truncate and delete Use the difference?
Truncate not recoverable after deleting records, not transaction management, principle: Delete entire table first, recreate
Delete can be managed by transaction, delete data in transaction can be rolled back (rollback) recovery, principle: Delete data record on one line
Third, record changes
Command: Update table name set column name = value, column name = value where condition statement;
* No where statement, update all rows of data, equivalent to where 1;
* When a conditional statement is a comparison string, it is more precise and strict to add the binary keyword after the where.
Iv. Record Enquiry
Command:Select column name, column name, ..., column name from table name where conditional statement;
A record in the query table that satisfies the criteria, and if it is a select * from table name, all records in the table are displayed
MySQL Learning notes--operations on records in a data table