Showing posts with label Practice Exercises. Show all posts
Showing posts with label Practice Exercises. Show all posts

Practice Task: Database Security Basics

Here’s a practice task and a short quiz on Database Security Basics to reinforce Part 11’s concepts.

๐Ÿ“š This is based on Part 11: Database Security Basics. If you haven’t read it yet, check that out first.


๐Ÿงช Practice Task: Setting Up User Roles and Permissions


๐ŸŽฏ Objective:

Create users with specific roles and test their access permissions in both SQL and MongoDB.


๐Ÿ”น Part A: SQL Practice

  1. Create two users:

  • reader_user with permission to only read data from a database named SchoolDB.

  • editor_user with permission to read and write data on the same database.

  1. Test the permissions by running SELECT queries as both users, and attempt to insert data as reader_user (which should fail).


๐Ÿ”น Part B: MongoDB Practice

  1. Create two users in the library database:

  • readUser with read-only access.

  • writeUser with read and write access.

  1. Using the Mongo shell or your MongoDB client, test that:

  • readUser can query data but cannot insert or update.

  • writeUser can both query and modify data.


Quiz: Quick Security Check

  1. What SQL command is used to grant specific privileges to a user?

    a) CREATE USER
    b) GRANT
    c) REVOKE
    d) ALTER USER

  2. In MongoDB, which role allows both reading and writing to a database?

    a) read
    b) readWrite
    c) dbAdmin
    d) clusterAdmin

  3. What is the main purpose of encryption in databases?

    a) Speed up queries
    b) Protect data confidentiality
    c) Organize data in tables
    d) Backup data automatically

  4. Which security principle suggests giving users only the permissions they need?

    a) Principle of least privilege
    b) Separation of duties
    c) Data masking
    d) Role hierarchies


Next: answer key and explanations for this quiz


Featured Post

Practice Task: Database Security Basics

Here’s a practice task and a short quiz on Database Security Basics to reinforce Part 11’s concepts. ๐Ÿ“š This is based on Part 11: Databas...

Popular Posts