Basic MySQL Data Operations, MySQL DATA operations

Source: Internet
Author: User

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;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.