0
0
MySQLquery~5 mins

CREATE TABLE syntax in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AMAKE TABLE
BNEW TABLE
CCREATE TABLE
DADD TABLE
In the statement CREATE TABLE users (id INT, name VARCHAR(50));, what does VARCHAR(50) mean?
AA text column with max 50 characters
BA number column with max 50 digits
CA date column with 50 days
DA boolean column
Which of these is a valid data type for a column in MySQL?
ATEXTUAL
BINT
CNUMBERIC
DCHARACTERSTRING
What does the PRIMARY KEY constraint do?
ACreates a foreign key
BAllows duplicate values
CStores large text
DUniquely identifies each row
Which symbol is used to separate columns in a CREATE TABLE statement?
A,
B.
C:
D;
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.