Bird
Raised Fist0
PostgreSQLquery~10 mins

Why CRUD operations are fundamental in PostgreSQL - Test Your Understanding

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all columns from the table named 'employees'.

PostgreSQL
SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
A*
BALL
Ccolumns
Deverything
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ALL' instead of '*'
Writing 'columns' which is not valid SQL syntax
2fill in blank
medium

Complete the code to insert a new row into the 'employees' table with name 'John' and age 30.

PostgreSQL
INSERT INTO employees (name, age) VALUES ([1]);
Drag options to blanks, or click blank then click option'
A(John, 30)
BJohn, 30
C'John', '30'
D'John', 30
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around string values
Including extra parentheses inside VALUES
3fill in blank
hard

Fix the error in the code to update the age of employee 'John' to 31.

PostgreSQL
UPDATE employees SET age = [1] WHERE name = 'John';
Drag options to blanks, or click blank then click option'
A31
B"31"
C'31'
Dage + 1
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers in quotes
Using double quotes instead of single quotes for strings
4fill in blank
hard

Fill both blanks to delete rows where age is less than 25.

PostgreSQL
DELETE FROM employees WHERE age [1] [2];
Drag options to blanks, or click blank then click option'
A<
B>
C25
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Using greater than symbol instead of less than
Using wrong number for comparison
5fill in blank
hard

Fill all three blanks to select the name and age of employees older than 40.

PostgreSQL
SELECT [1], [2] FROM employees WHERE age [3] 40;
Drag options to blanks, or click blank then click option'
Aname
Bage
C>
Dname, age
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting only one column
Using less than symbol instead of greater than

Practice

(1/5)
1. What does the 'C' in CRUD stand for in database operations?
easy
A. Connect
B. Copy
C. Calculate
D. Create

Solution

  1. Step 1: Understand CRUD acronym

    CRUD stands for Create, Read, Update, Delete, which are basic database operations.
  2. Step 2: Identify 'C' meaning

    The 'C' specifically means 'Create', which is adding new data to the database.
  3. Final Answer:

    Create -> Option D
  4. Quick Check:

    CRUD 'C' = Create [OK]
Hint: Remember CRUD = Create, Read, Update, Delete [OK]
Common Mistakes:
  • Confusing 'C' with Copy
  • Thinking 'C' means Connect
  • Mixing 'C' with Calculate
2. Which SQL statement is used to update existing data in a table?
easy
A. INSERT INTO
B. DELETE
C. UPDATE
D. SELECT

Solution

  1. Step 1: Recall SQL CRUD commands

    INSERT INTO adds data, SELECT reads data, DELETE removes data, UPDATE modifies data.
  2. Step 2: Match operation to statement

    To change existing data, the UPDATE statement is used.
  3. Final Answer:

    UPDATE -> Option C
  4. Quick Check:

    Update data = UPDATE [OK]
Hint: Update data with UPDATE statement [OK]
Common Mistakes:
  • Using INSERT to update
  • Using DELETE instead of UPDATE
  • Confusing SELECT with UPDATE
3. Given the table users(id INT, name TEXT), what will this query return?
SELECT * FROM users WHERE id = 3;
medium
A. All users with id 3
B. All users with id not equal to 3
C. Syntax error
D. Empty result always

Solution

  1. Step 1: Understand SELECT with WHERE clause

    The query selects all columns from users where id equals 3.
  2. Step 2: Determine result

    It returns rows where id is exactly 3, so all users with id 3.
  3. Final Answer:

    All users with id 3 -> Option A
  4. Quick Check:

    WHERE id = 3 returns matching rows [OK]
Hint: WHERE filters rows matching condition [OK]
Common Mistakes:
  • Thinking it returns all users
  • Confusing = with != operator
  • Assuming syntax error
4. Identify the error in this SQL statement:
UPDTE users SET name = 'Alice' WHERE id = 1;
medium
A. Typo in UPDATE keyword
B. Missing WHERE clause
C. Incorrect table name
D. Missing SET keyword

Solution

  1. Step 1: Check SQL keywords

    The statement tries to update users but spells UPDATE as UPDTE.
  2. Step 2: Identify syntax error

    This typo causes a syntax error because UPDTE is not a valid SQL command.
  3. Final Answer:

    Typo in UPDATE keyword -> Option A
  4. Quick Check:

    Correct keyword is UPDATE [OK]
Hint: Check spelling of SQL keywords carefully [OK]
Common Mistakes:
  • Ignoring typos
  • Assuming missing WHERE is error
  • Confusing SET keyword usage
5. You want to remove a user from the users table but keep a record of their name in a separate deleted_users table. Which sequence of CRUD operations is best?
hard
A. DELETE from users, then INSERT into deleted_users
B. INSERT into deleted_users, then DELETE from users
C. UPDATE users to mark deleted, no DELETE needed
D. SELECT user, then DELETE from users

Solution

  1. Step 1: Preserve data before deletion

    First, copy the user's name into deleted_users using INSERT to keep record.
  2. Step 2: Remove user from users table

    After saving, DELETE the user from users table to remove them.
  3. Final Answer:

    INSERT into deleted_users, then DELETE from users -> Option B
  4. Quick Check:

    Save data before delete = INSERT then DELETE [OK]
Hint: Insert backup before delete to keep data safe [OK]
Common Mistakes:
  • Deleting before saving data
  • Only updating without delete
  • Ignoring backup step
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard