Database Operations and Data Access Quiz Quiz

  1. Understanding CRUD Basics

    Which of the following operations is NOT represented by the CRUD acronym in the context of databases?

    1. Create
    2. Read
    3. Upload
    4. Update
    5. Delete
  2. SQL Statement for Deleting Data

    What is the correct SQL statement to remove all records from a table named 'users'?

    1. DELETE FROM users;
    2. REMOVE ALL FROM users;
    3. DROP users;
    4. DELETE * FROM users;
    5. ERASE users;
  3. Primary Key Constraint

    In a relational database, what is the main purpose of a primary key in a table?

    1. To uniquely identify each row
    2. To store encrypted passwords
    3. To speed up database backups
    4. To allow multiple rows with the same value
    5. To prevent data from being read
  4. Choosing the Correct SQL SELECT Syntax

    Which SQL query selects all columns from the 'products' table?

    1. SELECT * FROM products;
    2. CHOOSE ALL FROM products;
    3. SELECT products FROM *;
    4. FIND FROM products;
    5. SELECT ALL FROM products
  5. Updating Records Scenario

    To change the email address of a user with id=7 in the 'users' table, which SQL statement should you use?

    1. UPDATE users SET email = 'new@email.com' WHERE id = 7;
    2. MODIFY users email TO 'new@email.com' IF id = 7;
    3. CHANGE users email = 'new@email.com' ON id = 7;
    4. ALTER users SET email='new@email.com' AND id=7;
    5. UPDATE users email = 'new@email.com' WHERE id IS 7;
  6. Preventing Duplicate Data

    Which database constraint prevents duplicate values in a specific column?

    1. UNIQUE
    2. PRIMARY
    3. INDEX
    4. FOREIGN
    5. REFERENCE
  7. Inserting Data Correctly

    What is the correct way to insert a new record into a table called 'orders' with columns 'id' and 'amount' in SQL?

    1. INSERT INTO orders (id, amount) VALUES (1, 100);
    2. ADD INTO orders VALUES (1, 100);
    3. INSERT orders (id, amount) = (1, 100);
    4. PUT (1, 100) IN orders;
    5. INSERT TO orders VALUES (1, 100);
  8. Retrieving Unique Values

    Which SQL keyword will return only distinct (different) values from the 'category' column of a 'items' table?

    1. SELECT DISTINCT category FROM items;
    2. SELECT UNIQUE category IN items;
    3. SELECT category ONLY FROM items;
    4. SELECT DIFFERENT category FROM items;
    5. SELECT category FROM items UNIQUE;
  9. Nested SELECT Usage

    What is the role of a subquery in a SQL statement?

    1. It returns data for use by the main query
    2. It updates all rows in a table
    3. It creates a new table in the database
    4. It drops columns from a table
    5. It sorts the results by ascending order
  10. Effect of SQL DROP Operation

    What does the SQL command DROP TABLE users; do?

    1. Deletes the entire 'users' table and all its data
    2. Removes only the data from 'users', keeps the table structure
    3. Deletes one row from the 'users' table
    4. Deletes the primary key from the 'users' table
    5. Removes only null values from the 'users' table