Recall & Review
beginner
What is the purpose of the
CREATE TABLE statement in SQL?The
CREATE TABLE statement is used to make a new table in a database where you can store data in rows and columns.Click to reveal answer
beginner
Which keyword defines the name of the table in a
CREATE TABLE statement?The table name comes right after the
CREATE TABLE keywords. For example, in CREATE TABLE students, students is the table name.Click to reveal answer
beginner
How do you specify columns and their data types when creating a table?
Inside parentheses after the table name, list each column name followed by its data type, separated by commas. For example:
(id INT, name VARCHAR(50)).Click to reveal answer
intermediate
What does
PRIMARY KEY mean in a CREATE TABLE statement?A
PRIMARY KEY is a column (or set of columns) that uniquely identifies each row in the table. It helps keep data organized and prevents duplicates.Click to reveal answer
beginner
Write a simple
CREATE TABLE statement for a table named books with columns id (integer primary key) and title (text up to 100 characters).Example:<br>
CREATE TABLE books (id INT PRIMARY KEY, title VARCHAR(100));Click to reveal answer
What keyword starts the command to create a new table in SQL?
✗ Incorrect
The correct syntax to create a table starts with
CREATE TABLE.In the statement
CREATE TABLE users (id INT, name VARCHAR(50));, what does VARCHAR(50) mean?✗ Incorrect
VARCHAR(50) means a text column that can hold up to 50 characters.Which of these is a valid data type for a column in MySQL?
✗ Incorrect
INT is a valid data type for integers in MySQL.What does the
PRIMARY KEY constraint do?✗ Incorrect
PRIMARY KEY ensures each row is unique and identifiable.Which symbol is used to separate columns in a
CREATE TABLE statement?✗ Incorrect
Columns are separated by commas
, inside the parentheses.Explain the basic structure of a
CREATE TABLE statement and what each part does.Think about how you tell the database to make a new box (table) with labeled sections (columns).
You got /4 concepts.
Describe why defining a
PRIMARY KEY is important when creating a table.Imagine a student ID that is unique for each student.
You got /3 concepts.