0
0
SQLquery~5 mins

CREATE TABLE syntax in SQL - 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 data can be stored in rows and columns.
Click to reveal answer
beginner
Which keyword is used to define a column's data type in a CREATE TABLE statement?
The data type of a column is defined right after the column name, for example: column_name INT means the column stores integers.
Click to reveal answer
intermediate
What does the PRIMARY KEY constraint do in a CREATE TABLE statement?
PRIMARY KEY ensures that each row in the table has a unique and not null value in that column, helping to identify each record uniquely.
Click to reveal answer
beginner
Write the basic syntax to create a table named 'Students' with columns 'ID' as integer and 'Name' as text.
CREATE TABLE Students (ID INT, Name TEXT);
Click to reveal answer
intermediate
Can you add a NOT NULL constraint to a column in CREATE TABLE? What does it mean?
Yes, adding NOT NULL means the column must always have a value; it cannot be left empty when inserting data.
Click to reveal answer
Which SQL command is used to create a new table?
ASELECT
BINSERT INTO
CDROP TABLE
DCREATE TABLE
In the statement CREATE TABLE People (Age INT);, what does INT specify?
AThe data type of the column
BThe column name
CThe table name
DA constraint
What does the PRIMARY KEY constraint ensure?
AColumn values are optional
BColumn values can be duplicated
CColumn values must be unique and not null
DColumn values are always text
Which of these is a valid CREATE TABLE syntax?
ACREATE TABLE (Name TEXT, Age INT);
BCREATE TABLE Students (Name TEXT, Age INT);
CCREATE Students TABLE (Name TEXT, Age INT);
DCREATE TABLE Students Name TEXT, Age INT;
What does NOT NULL mean when used in a column definition?
AThe column must always have a value
BThe column can have empty values
CThe column is optional
DThe column stores numbers only
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 with labeled sections.
You got /5 concepts.
    Describe how constraints like PRIMARY KEY and NOT NULL affect the data stored in a table.
    Constraints are rules that keep the data clean and organized.
    You got /4 concepts.