0
0
MySQLquery~30 mins

CREATE TABLE syntax in MySQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Create a Simple Table with CREATE TABLE Syntax
📖 Scenario: You are setting up a small database for a local bookstore. You need to create a table to store information about books.
🎯 Goal: Build a table named books with columns for id, title, and author using the CREATE TABLE statement.
📋 What You'll Learn
Create a table named books
Add a column id as an integer and primary key
Add a column title as a variable character string with a maximum length of 100
Add a column author as a variable character string with a maximum length of 50
💡 Why This Matters
🌍 Real World
Creating tables is the first step in building a database to store organized data for applications like bookstores, libraries, or any business.
💼 Career
Database developers and administrators frequently write CREATE TABLE statements to design and set up databases.
Progress0 / 4 steps
1
Create the books table with id column
Write a CREATE TABLE statement to create a table named books with one column called id of type INT.
MySQL
Need a hint?

Start with CREATE TABLE books ( and add the id INT column inside the parentheses.

2
Add title column to the books table
Add a column named title to the books table with type VARCHAR(100) after the id column.
MySQL
Need a hint?

Add title VARCHAR(100) after id INT separated by a comma.

3
Add author column to the books table
Add a column named author to the books table with type VARCHAR(50) after the title column.
MySQL
Need a hint?

Add author VARCHAR(50) after title VARCHAR(100) separated by a comma.

4
Make id the primary key
Modify the id column to be the primary key by adding PRIMARY KEY after INT in the CREATE TABLE statement.
MySQL
Need a hint?

Add PRIMARY KEY right after INT for the id column.