8. SQL Statements : CREATE ROLE : CREATE ROLE Examples
 
Share this page                  
CREATE ROLE Examples
1. Create a role identifier and password for the inventory application of a bookstore.
CREATE ROLE bks_onhand WITH PASSWORD = 'hgwells';
2. Create a role identifier with no password for the daily sales application of the bookstore.
CREATE ROLE dly_sales WITH NOPASSWORD;
3. Create a role identifier and its password for the new employee application of the bookstore.
CREATE ROLE new_emp WITH PASSWORD = 'good luck';
4. In an application, create a role identifier and its password for an accounts payable application.
EXEC SQL CREATE ROLE acct_pay WITH PASSWORD = piper;
5. Create a role with a password and additional privileges.
CREATE ROLE sysop
WITH PASSWORD = 'sysoppwd',
PRIVILEGES = (OPERATOR, CREATEDB, MAINTAIN_LOCATIONS);
6. Create a role with external password verification.
CREATE ROLE sysop
WITH EXTERNAL_PASSWORD;