Add data
When the primary key conflict is, choose how to Do
Insert into table (id,name,age) value ("ddd", 45)
On duplicate key update name= ' DDD ' age=45;
The default has a PRIMARY KEY constraint and will not be inserted successfully
However, you can change to perform an update operation within the INSERT syntax when you control the primary key conflict
Replace: If primary key conflicts, select Replace, if primary key does not conflict, add a record
Replace into hd_cate values (XXX,XXX,XXX);
Delete format: Delete from one,two using one join both on condition where condition (simulated foreign key technology)
Empty tables truncate TABLE;
multiple table update; update Tabel1 join table2 on conditional set content where condition
Data backup:
Mysqldump-u root-p Blog >e:/blog.sql (Backup database)
Mysqldump-u root-p Blog Hd_cate >e:/hd_cate.sql (back up the tables in the database)
Mysqldump-u root-p hd_cate table_name1 table_name >e:/hd_cate.sql (backup multiple tables)
Backup restore: Source E:/hd_cate.sql
Creating views Create View V_cate as select Id,name from Hd_cate;
The view is a village and a virtual table in the database
The view, which has no data in itself, is simply done by executing the corresponding SELECT statement to obtain the corresponding data
The view saves only one SQL statement
MySQL database added delete and new, associated data