Any2Quiz
Quizzes / Computer Science / Languages / SQL

DML Quiz - Languages SQL

Free practice quiz: DML (Languages SQL). 54 multiple-choice questions with answers and explanations. Play online, no sign-up needed.

This Languages SQL practice quiz has 54 multiple-choice questions on DML, and 54 of them come with an explanation. Try the 5 sample questions below (tap an option to check yourself), then play the full quiz online. No sign-up needed.

Start quiz: 54 questions, free

Sample questions

  1. Consider a table `Employees` with columns `EmployeeID`, `FirstName`, `LastName`, `Department`, and `Salary`. Which DML statement would you use to increase the salary of all employees in the 'Sales' department by 10%?

    Show answer

    Answer: B. UPDATE Employees SET Salary = Salary * 1.10 WHERE Department = 'Sales';

    The UPDATE statement is used to modify existing records in a table. The SET clause specifies the column to be updated and the new value, while the WHERE clause filters the rows to be updated. Multiplying the current Salary by 1.10 increases it by 10%.

  2. Which DML statement is used to modify specific values in existing records of a table?

    Show answer

    Answer: B. UPDATE

    The UPDATE statement is used to change the values in one or more columns of existing rows in a table.

  3. Which DML statement can be used to change the values in one or more columns for existing records?

    Show answer

    Answer: C. UPDATE

    The UPDATE statement is used to modify existing data within a table.

  4. Consider the `Employees` table with `EmployeeID`, `Name`, `Salary`, `Department`. You want to update the `Department` of the employee with `EmployeeID` 103 to 'Marketing'. Which DML statement is correct?

    Show answer

    Answer: B. UPDATE Employees SET Department = 'Marketing' WHERE EmployeeID = 103;

    The UPDATE statement modifies the 'Department' column to 'Marketing' for the specific employee identified by 'EmployeeID = 103'.

  5. Which DML command is used to retrieve specific information from a database table?

    Show answer

    Answer: C. SELECT

    The SELECT statement is the primary DML command for retrieving data.

Take the full quiz

More questions in this quiz

Answers and explanations are in the full quiz.

  1. You have a table `Products` with columns `ProductID`, `ProductName`, `Category`, and `Price`. Which DML statement is used to insert a new product named 'Laptop' with Category 'Electronics' and Price 1200.00 into the table?
  2. You want to remove all records from a table named `Orders` that were placed before January 1st, 2023. Assume the table has a `OrderDate` column of type DATE. Which DML statement would achieve this?
  3. Consider a table `Customers` with columns `CustomerID`, `Name`, `City`, and `Country`. If you want to select only the names of customers from 'London', what DML statement would you use?
  4. What is the primary purpose of the `SELECT` statement in SQL?
  5. Which DML command is typically used to add a single new record to a database table?
  6. When updating multiple rows using the `UPDATE` statement, what clause is essential to specify which rows should be modified?
  7. If you want to remove all rows from a table without deleting the table structure itself, which DML command is the most efficient?
  8. Consider a table `Products` with columns `ProductID`, `Name`, `Price`. You want to retrieve the `Name` and `Price` of all products whose `Price` is greater than 50. Which `SELECT` statement would you use?
  9. You have a table `Students` with columns `StudentID`, `Name`, `Major`. You want to add a new student named 'Alice Wonderland' with Major 'Computer Science'. Which `INSERT` statement is correct?
  10. Consider the `Employees` table with columns `EmployeeID`, `Name`, `Salary`. If you want to set the `Salary` of the employee with `EmployeeID` 101 to 75000, which DML statement is correct?
  11. Which DML statement permanently removes rows from a table?
  12. You have a table `Books` with columns `BookID`, `Title`, `Author`, `PublicationYear`. Which DML statement will insert a new book titled 'The Great Gatsby' by 'F. Scott Fitzgerald', published in 1925?
  13. Which DML command is used to retrieve specific columns from a table based on certain criteria?
  14. You need to change the `Category` of all products in the 'Electronics' category to 'Computers'. Which DML statement would you use?
  15. Which DML statement is used to add new rows to a table?
  16. If you want to delete all records from the `Logs` table, which DML statement is generally faster than `DELETE FROM Logs`?
  17. Consider the `Orders` table with columns `OrderID`, `CustomerID`, `OrderDate`, `TotalAmount`. You want to retrieve the `OrderID` and `TotalAmount` for all orders placed in December 2023. Assume `OrderDate` is a DATE type. Which statement is correct?
  18. Which DML statement is used to remove all rows from a table, but keeps the table structure intact?
  19. You have a table `Employees` with columns `EmployeeID`, `Name`, `Department`. You want to add a new employee, `EmployeeID` 105, named 'Bob Smith', in the 'IT' department. Which `INSERT` statement is correct?
  20. Consider the `Products` table with columns `ProductID`, `ProductName`, `Price`. You want to double the price of all products whose `ProductName` starts with 'A'. Which DML statement is correct?
  21. Which DML statement is used to remove specific rows from a table based on a condition?
  22. You have a table `Students` with columns `StudentID`, `Name`, `GPA`. You want to retrieve the `Name` of all students whose `GPA` is above 3.5. Which `SELECT` statement is correct?
  23. Which DML statement is used to add new records to a table, specifying the values for each column?
  24. Consider the `Orders` table with `OrderID`, `CustomerID`, `OrderDate`. You want to delete all orders placed before '2022-01-01'. Which DML statement is correct?
  25. Which DML statement allows you to fetch data from a database?
  26. You have a table `Products` with `ProductID`, `Name`, `Price`. You want to increase the `Price` of the product with `ProductID` 50 by 5%. Which DML statement is correct?
  27. Which DML command removes all rows and associated data from a table, but retains the table's structure?
  28. You have a table `Users` with columns `UserID`, `Username`, `Email`. You want to add a new user with `UserID` 201, `Username` 'admin', and `Email` 'admin@example.com'. Which `INSERT` statement is correct?
  29. Which DML statement is used to retrieve a subset of columns from a table?
  30. Which DML statement is used to remove all records from a table without affecting the table's structure?
  31. You have a table `Customers` with `CustomerID`, `Name`, `Country`. You want to add a new customer named 'Jane Doe' from 'Canada'. Which `INSERT` statement is correct?
  32. Which DML command is used to retrieve data from a database, allowing filtering and sorting of results?
  33. You have a table `Books` with `BookID`, `Title`, `Author`, `Genre`. You want to change the `Genre` of the book with `BookID` 789 to 'Science Fiction'. Which DML statement is correct?
  34. Which DML statement is used to remove all rows from a table, but is typically slower than TRUNCATE TABLE for large datasets?
  35. Consider the `Products` table with `ProductID`, `Name`, `Price`. You want to insert a new product with `ProductID` 301, `Name` 'Keyboard', and `Price` 75.00. Which `INSERT` statement is correct?
  36. Which DML command is used to query data from a table?
  37. You have a table `Students` with `StudentID`, `Name`, `EnrollmentDate`. You want to change the `EnrollmentDate` of the student with `StudentID` 222 to '2024-01-15'. Which DML statement is correct?
  38. Which DML statement is used to add new data records to a table?
  39. You have a table `Employees` with `EmployeeID`, `Name`, `Salary`. You want to delete all employees who earn more than 100000. Which DML statement is correct?
  40. Consider the `Products` table with `ProductID`, `Name`, `Price`. You want to insert a new product 'Monitor' with `Price` 300.00. If `ProductID` is auto-incrementing, which `INSERT` statement is correct?
  41. Which DML statement is used to modify data in existing rows?
  42. You have a table `Customers` with `CustomerID`, `Name`, `City`. You want to update the `City` of the customer with `CustomerID` 55 to 'New York'. Which DML statement is correct?
  43. Which DML statement is used to delete all rows from a table quickly, resetting its state?
  44. Consider the `Orders` table with `OrderID`, `CustomerID`, `OrderDate`, `TotalAmount`. You want to retrieve all columns for orders placed on '2023-07-15'. Which DML statement is correct?
  45. Which DML statement is used to add a new record to a database table?
  46. You have a table `Products` with `ProductID`, `Name`, `Price`. You want to increase the price of all products by 2%. Which DML statement is correct?
  47. Which DML command is used to retrieve data from a table, potentially filtering by specific conditions?
  48. You have a table `Students` with `StudentID`, `Name`, `Major`. You want to add a new student named 'Peter Pan' with Major 'Adventure'. Which `INSERT` statement is correct?
  49. Which DML statement removes specific rows from a table based on a condition?

More quizzes

Browse all SQL quizzes

More to play

Daily ChallengeA new quiz every day. Keep your streak.HangmanGuess the word, letter by letter.Story QuestLearn through short interactive stories.All quizzesCBSE, ICSE, competitive exams and more.