![]() order_id | customer_name | product_name | amount VALUES ('MARY SMITH', 'PREMIUM MEMBERSHIP', 75.25) Įnsure the records are in place by executing a SELECT statement against the orders table. VALUES ('PETER ERIC', 'ELITE MEMBERSHIP', 25.25) INSERT INTO orders (customer_name, product_name, amount) VALUES ('JOHN DOE', 'BASIC MEMBERSHIP', 5.25) store_db=# INSERT INTO orders (customer_name, product_name, amount) Insert the following sample records into the orders table. Then, execute the SQL command below to create a store_db database. $ sudo -u postgres psqlĮnter your postgres user password and press ENTER to proceed. Then, log in to your PostgreSQL database server as postgres. SSH to your server and follow the steps below to create a sample database and table. In this guide, you'll implement role-based permissions on the PostgreSQL database on your Ubuntu 20.04 server. However, with the role-based model, you only need to create three roles to assign privileges to the users. Without roles, you would have to manually assign the permissions to each user. In the above example, assume you have three store administrators, seven order specialists, and 15 customer support staff in your company. ![]() Order specialists can create and view the orders, but they can not delete or update them.Ĭustomer support staff can only view the order details, but they can not change or create new orders. System administrators can create, view, update, and delete orders. In this scenario, you have three roles: system administrators, order specialists, and customer support. ![]() One great example of a scenario where you can use database roles is an e-commerce application to process orders. Roles simplify assigning bundled privileges to users in a multi-user environment using a single statement. In a PostgreSQL server, a role is a collection of permissions that you can assign to one or more users.
0 Comments
Leave a Reply. |