当前位置:网站首页>Mysql database DML operation exercise

Mysql database DML operation exercise

2022-06-22 22:34:00 Fire eye Dragon

1. Create table :
Create an employee table employee, The fields are as follows :
id( Employee number ),name( Employee name ),gender( Gender of employees ),salary( Employee pay )

2. insert data
1,‘ Zhang San ’,‘ male ’,2000
2,‘ Li Si ’,‘ male ’,1000
3,‘ Wang Wu ’,‘ Woman ’,4000

3. Modify table data
3.1 Change all employee salaries to 5000 element
3.2 Change the salary of the employee named Zhang San to 3000 element
3.3 Change the salary of the employee whose name is Li Si to 4000 element ,gener Changed to female
3.4 Increase Wang Wu's salary on the original basis 1000 element

CREATE TABLE IF NOT EXISTS employee(
id INT,
name VARCHAR(20),
gender VARCHAR(2),
salary INT
);

INSERT INTO employee VALUES(1,' Zhang San ',' male ',2000),
(2,' Li Si ',' male ',1000),
(3,' Wang Wu ',' Woman ',4000);

UPDATE employee SET salary = 5000;

UPDATE employee set salary = 3000 WHERE name =' Zhang San ';

UPDATE employee SET salary = 4000 , gender=' Woman ' WHERE name=' Li Si ';

UPDATE employee SET salary= salary +1000 WHERE name=' Wang Wu ';
原网站

版权声明
本文为[Fire eye Dragon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221824155571.html