Posts

Showing posts from March, 2026

CA 33 - Users, Roles, Groups

Image
  Task 1 : Create a login role report_user that can only read from the film table.              Step 1 :-   We should first create a role named report_user with Login access along side a password So now a Role 'report_User' has been created with login access and password as 'report_user123'          Step 2 :- The role should be now able to access the database 'dvdrental' inorder to perform select query in film table           Step3 :- Now the role should be only able to perform select operation on the film table this we only grant the select access to this role Task 2: Now try to access customer table. When report_user tries to query customer and gets permission denied. Fix it.     In order to access the customer table first we will login as the report_user. To avoid this problem also mention the db in which you can connect.     Now that we are connected let us t...

CA 36 - Isolation

Image
   Building a (similar to PhonePe / GPay / Paytm). Users can, Store money in their wallet Transfer money to other user View transaction history This system must strictly follow , because even a small inconsistency can lead to, Money loss Duplicate transactions Incorrect balances accounts table  CREATE TABLE accounts (     id SERIAL PRIMARY KEY,     name TEXT NOT NULL,     balance INT NOT NULL CHECK (balance >= 0),     last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP );        The table is created having id as the Primary Key which is serial, thus the id will be in a sequence. The name and the balance is set to NOT nULL, thus they cannot have null values.     Also a check condition is given for the balance that the balance column cannot have negative values. And a default is used for the last_updated column to set the current date. Entering a dummy value :           ...

CA 34 - Atomicity - Design a Reliable Wallet Transfer System with ACID Guarantees

Image
 B uilding a (similar to PhonePe / GPay / Paytm). Users can, Store money in their wallet Transfer money to other users View transaction history This system must strictly follow , because even a small inconsistency can lead to, Money loss Duplicate transactions Incorrect balances TABLE :     A ccounts table:           QUERY -  CREATE TABLE accounts (                                   id SERIAL PRIMARY KEY,                                   name TEXT NOT NULL,                                   balance INT NOT NULL CHECK (balance >= 0),                            ...