Use mysql as the database
Additions, deletions and modifications are relatively simple. Write them here separately. The query is the most complicated, and write separately.
Generalized additions, deletions and modifications
One, increase
New database:
create DATABASE <database name>;
Example: CREATE DATABASE IF NOT EXISTS <database name> DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Create a database, the role of the command:
- 1. If the database does not exist, create it, and do not create it.
- 2. Create RUNOOB database and set the code set to utf8
Add table
New table field
Add table data
2. Delete
Delete the library: drop database <database name>;
Delete table
Delete table field
Delete table data
Three, change
Generally, the library name and table name will not be changed, and generally only the table fields and table data will be changed.
When we need to modify the data table name or modify the data table fields, we need to use the MySQL ALTER command.
If we need to modify or update the data in MySQL, we can use the SQL UPDATE command to operate.
Only add, delete and modify the data in the table
1. Insert data
Use INSERT INTO SQL statement to insert data
INSERT INTO 表名( 列1, 列2,...列N )
VALUES ( value1, value2,...valueN );
如果数据是字符型,必须使用单引号或者双引号,如:"value"。
2. Delete data
Use the DELETE FROM statement to delete records in the MySQL data table
DELETE FROM 表名
[WHERE 筛选条件]
3. Modify
When we need to modify the data table name or modify the data table fields, we need to use the MySQL ALTER command.
If we need to modify or update the data in MySQL, we can use the SQL UPDATE command to operate.