Single table query exercise

1. Create a table:

 Create the employee table employee with the following fields:

 id (employee number), name (employee name), gender (employee gender), salary (employee salary)

 2. Insert data

 1, 'Zhang San', 'Male', 2000

 2, 'Li Si', 'Male', 1000

 3, 'Wang Wu', 'Female', 4000

3. Modify table data

 3.1 Modify the salary of all employees to 5000 yuan

 3.2 Change the salary of the employee named Zhang San to 3,000 yuan

 3.3 Change the salary of the employee named Li Si to 4,000 yuan, and change the gener to female

 3.4 Increase Wang Wu's salary by 1,000 yuan on the original basis

Modify the salary of all employees to 5000 yuan

update employee set salary = 5000 ;

Change the salary of the employee named Zhang San to 3000 yuan

update employee set salary = 3000 where name = 'zhangshan';

Change the salary of the employee named Li Si to 4,000 yuan, and change the gener to female

update employee set salary = 4000 where name = 'lishi';

Increase Wang Wu's salary by 1,000 yuan on the original basis

update employee set salary = salary + 1000 where name = 'wangwu';

Guess you like

Origin blog.csdn.net/m0_70940822/article/details/131651351