MySQL Worksheet 6: INSERT Commands for Class XII and Class XI

 


Here’s a worksheet focused on the INSERT commands in MySQL, designed for Class XII students. This worksheet includes various types of questions to reinforce their understanding of how to add data to databases.


MySQL Worksheet: INSERT Commands

Name: ___________________
Date: ___________________

Part A: Multiple Choice Questions

  1. Which command is used to insert new records into a table?

    • a) INSERT INTO
    • b) ADD RECORD
    • c) UPDATE
    • d) CREATE
  2. The correct syntax to insert values into a table named "Students" is:

    • a) INSERT INTO Students VALUES (...);
    • b) ADD INTO Students (...);
    • c) INSERT VALUES INTO Students (...);
    • d) INSERT INTO Students SET (...);
  3. Which keyword allows you to specify which columns you are inserting data into?

    • a) VALUES
    • b) COLUMNS
    • c) SET
    • d) INTO

Part B: True/False Questions

  1. T/F: You must provide values for all columns when using the INSERT command.

  2. T/F: The INSERT command can be used to add multiple rows in a single statement.

  3. T/F: NULL values cannot be inserted into columns that are defined with the NOT NULL constraint.

Part C: Fill in the Blanks

  1. The SQL command to insert a new student with the name "Alice" and age 20 into the "Students" table is __________.

  2. To insert multiple rows into a table, you would separate each set of values with __________.

  3. If a column has a default value, you can omit it in the INSERT statement by using __________.

Part D: Short Answer Questions

  1. Write the SQL command to insert a record into the "Employees" table with the following fields: EmployeeID (1), FirstName ('John'), LastName ('Doe'), HireDate ('2023-01-15').

  2. Write the SQL command to insert two new products into the "Products" table, assuming it has columns: ProductID, ProductName, and Price.

  3. Explain the difference between the INSERT INTO ... VALUES and INSERT INTO ... SELECT commands.

Part E: Practical Application

  1. Write a command to insert a new customer into the "Customers" table with the following details: CustomerID (101), Name ('Jane Smith'), City ('Los Angeles').

  2. Write a command to insert multiple records into the "Orders" table, assuming it has columns: OrderID and OrderDate.

  3. If you want to insert a new record into a table but want to ignore duplicate entries based on a unique key, what command would you use?


Post a Comment

0 Comments