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
Which command is used to insert new records into a table?
- a) INSERT INTO
- b) ADD RECORD
- c) UPDATE
- d) CREATE
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 (...);
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
T/F: You must provide values for all columns when using the INSERT command.
T/F: The INSERT command can be used to add multiple rows in a single statement.
T/F: NULL values cannot be inserted into columns that are defined with the NOT NULL constraint.
Part C: Fill in the Blanks
The SQL command to insert a new student with the name "Alice" and age 20 into the "Students" table is __________.
To insert multiple rows into a table, you would separate each set of values with __________.
If a column has a default value, you can omit it in the INSERT statement by using __________.
Part D: Short Answer Questions
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').
Write the SQL command to insert two new products into the "Products" table, assuming it has columns: ProductID, ProductName, and Price.
Explain the difference between the INSERT INTO ... VALUES and INSERT INTO ... SELECT commands.
Part E: Practical Application
Write a command to insert a new customer into the "Customers" table with the following details: CustomerID (101), Name ('Jane Smith'), City ('Los Angeles').
Write a command to insert multiple records into the "Orders" table, assuming it has columns: OrderID and OrderDate.
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?
0 Comments
Please do note create link post in comment section