MySQL Worksheet 1 : CREATE DATABASE and CREATE TABLE Commands for Class XII and Class XI


MySQL Worksheet 1 : CREATE DATABASE and CREATE TABLE Commands

Name: ___________________
Date: ___________________

Part A: Multiple Choice Questions

  1. Which command is used to create a new database in MySQL?

    • a) CREATE TABLE
    • b) CREATE DATABASE
    • c) INSERT DATABASE
    • d) NEW DATABASE
  2. When creating a table, which of the following is used to define a primary key?

    • a) UNIQUE
    • b) PRIMARY KEY
    • c) NOT NULL
    • d) DEFAULT
  3. What data type would you use to store a person's name in MySQL?

    • a) INT
    • b) VARCHAR
    • c) TEXT
    • d) CHAR

Part B: True/False Questions

  1. T/F: You can create multiple tables in a single CREATE TABLE command.

  2. T/F: The command CREATE DATABASE can be used to overwrite an existing database.

  3. T/F: The default value for a column can be set using the DEFAULT keyword in the CREATE TABLE statement.

Part C: Fill in the Blanks

  1. The SQL command to create a new database called "LibraryDB" is __________.

  2. A table can have multiple __________, but only one __________.

  3. To create a table with an auto-incrementing primary key, you would use the __________ attribute. Extra Out of syllabus

Part D: Short Answer Questions

  1. Write the SQL command to create a database named "EmployeeDB".

  2. Write the SQL command to create a table named "Employees" with the following fields:

    • EmployeeID (INT, Primary Key, Auto Increment)
    • FirstName (VARCHAR(50))
    • LastName (VARCHAR(50))
    • HireDate (DATE)
  3. Explain the purpose of the NOT NULL constraint in table creation.

Part E: Practical Application

  1. Write a command to create a database named "SchoolDB".

  2. Write a command to create a table named "Courses" with the following fields:

    • CourseID (INT, Primary Key, Auto Increment)
    • CourseName (VARCHAR(100), NOT NULL)
    • Credits (INT)



Post a Comment

0 Comments