在 SQL 中,可以使用 GRANT 語(yǔ)句來(lái)控制用戶對(duì)數(shù)據(jù)庫(kù)對(duì)象(如表、視圖、存儲(chǔ)過(guò)程等)的訪問(wèn)權(quán)限
GRANT SELECT ON table_name TO user_name;
GRANT INSERT ON table_name TO user_name;
GRANT UPDATE ON table_name TO user_name;
GRANT DELETE ON table_name TO user_name;
GRANT EXECUTE ON procedure_name TO user_name;
GRANT SELECT, INSERT, UPDATE, DELETE ON table_name TO user_name;
REVOKE SELECT ON table_name FROM user_name;
注意:請(qǐng)根據(jù)實(shí)際情況替換 table_name
、procedure_name
和 user_name
。不同的數(shù)據(jù)庫(kù)管理系統(tǒng)(如 MySQL、SQL Server、Oracle 等)可能有些許差異,因此在實(shí)際操作前,請(qǐng)參考相應(yīng)數(shù)據(jù)庫(kù)的文檔。