One, insert data
insert into 表名(字段1,字段2, ...) values(数据1, 数据2, ...);
Two, delete data
delete is used to delete data rows, and must be judged with where.
#将student表中id=2的数据行删除
delete from student where id = 2;
Three, modify the data
The update statement is used to modify the data, usually with where or having to make conditional judgments.
#将student表中id=1的name字段的数据修改为chenih
update student set name='chenih' where id=1;
Four, view the data
The select statement is used to query data, and it usually cooperates with where or having to make conditional judgments.
select * from 表名;
select 字段1, 字段2, ..., 字段n from 表名;
select * from 表名 where 字段名='数据值';
select * from 表名 having 字段名='数据值';
Five, copy the form
1. Copy the data of
the table The attributes of the fields in the original table will not be copied.
#将新表名中的数据复制到新表名中
create table 新表名 select * from 原表名 ;
2. Copy the structure and attributes of the
table The data in the original table will not be copied.
create table 新表名 like 原表名 ;