Basic MySQL Data Operations, MySQL DATA operations
Create data (insert data)
Insert into Table Name (Field List) valuse (Value List); insert into exam_student (stu_name, stu_no) values ('xiaoming', '123 ');
If you need to set values for all fields when inserting data, you can omit the Field List, which must be consistent with the field order in the table.
insert into exam_student values('zhangsan','3203423',100);
Obtain data (query data)
Select field list from table name query condition. The field list can be replaced by *, indicating all fields. The query condition can be omitted, indicating that all records are obtained, which is equivalent to where 1; select stu_name, stu_no from exam_student;
alter table exam_student add stu_score int;select * from exam_student;
Conditional search:
select * from exam_student where stu_age>50;
Delete data
The delete from table name condition must be logically specified. Otherwise, data misoperations may occur and losses may occur. The syntax does not have a where clause. Delete from exam_student where stu_age> 50;
Modify data
Update table name set field = new value,... condition; update exam_student set stu_age = 88 where stu_age <= 50;