Update:
更新某一行中的一个列:表名为employees,将姓Tobi的这一行中department这一列改为Sales
UPDATE employees SET department ='Sales' WHERE first_name='Tobi'
更新某一行中的若干列:将department改为Sales的同时,让他的薪水为0
UPDATE employees SET department='Sales',salary=0 WHERE first_name='Tobi'
Alter:
增加新列到指定位置:在薪水这一列之后加一列phone,类型为varchar
ALTER TABLE employees ADD phone varchar(20) after salary
删除某一列或其属性:删除phone这一列
ALTER TABLE employees DROP COLUMN phone
重命名表/列:employees->newemployees phone->telephone
ALTER TABLE employees RENAME TO newemployees
ALTER TABLE employees RENAME COLUMN phone TO telephone
Grant/Revoke:
赋予用户user对表employees的所有权利(all)、查询插入权利(select,insert)
GRANT all ON employees TO user identified by ‘password’
收回user查看视图的权利
REVOKE show view ON employees FROM user