MySQL Worksheet 1 : CREATE DATABASE and CREATE TABLE Commands
Name: ___________________
Date: ___________________
Part A: Multiple Choice Questions
Which command is used to create a new database in MySQL?
- a) CREATE TABLE
- b) CREATE DATABASE
- c) INSERT DATABASE
- d) NEW DATABASE
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
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
T/F: You can create multiple tables in a single CREATE TABLE command.
T/F: The command
CREATE DATABASE
can be used to overwrite an existing database.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
The SQL command to create a new database called "LibraryDB" is __________.
A table can have multiple __________, but only one __________.
To create a table with an auto-incrementing primary key, you would use the __________ attribute. Extra Out of syllabus
Part D: Short Answer Questions
Write the SQL command to create a database named "EmployeeDB".
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)
Explain the purpose of the
NOT NULL
constraint in table creation.
Part E: Practical Application
Write a command to create a database named "SchoolDB".
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)
0 Comments
Please do note create link post in comment section