例程练习
- 4.1
代码:
CREATE USER user1 WITH PASSWORD "user1@123"; GRANT SELECT ON TABLE student TO user1;
运行结果:
- 4.2
代码:
CREATE USER user2 WITH PASSWORD "user2@123"; CREATE USER user3 WITH PASSWORD "user3@123"; GRANT ALL PRIVILEGES ON TABLE student, course TO user2,user3;
运行结果:
- 4.3
代码:
GRANT SELECT ON TABLE sc TO public;
运行结果:
- 4.4
代码:
CREATE USER user4 WITH PASSWORD "user4@123"; GRANT UPDATE(sno),SELECT ON TABLE student TO user4;
运行结果:
- 4.5
代码:
CREATE USER user5 WITH PASSWORD "user5@123"; GRANT INSERT ON TABLE sc TO user5 WITH GRANT OPTION; 验证代码 insert into sc values ('200215129','0204',90); grant select on table sc to user4; grant insert on table sc to user4; grant insert on table sc to user4 with grant option;
运行结果:
- 4.6
代码:
CREATE USER user6 WITH PASSWORD "user6@123"; grant insert on table sc to user6 with grant option;
运行结果:
- 4.7
代码:
CREATE USER user7 WITH PASSWORD "user7@123"; grant insert on table sc to user7; grant insert on table sc to user1;
运行结果: