0
0
MySQLquery~30 mins

Integer types (TINYINT, INT, BIGINT) in MySQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Integer Types in MySQL: TINYINT, INT, BIGINT
📖 Scenario: You are managing a small online store database. You need to create a table to store product information including product ID, stock quantity, and total sales count. Different integer types are used to save space depending on the size of the numbers.
🎯 Goal: Create a MySQL table called products with columns using TINYINT, INT, and BIGINT integer types appropriately to store product ID, stock quantity, and total sales count.
📋 What You'll Learn
Create a table named products
Add a column product_id using TINYINT
Add a column stock_quantity using INT
Add a column total_sales using BIGINT
💡 Why This Matters
🌍 Real World
Using appropriate integer types helps save storage space and improves database performance in real-world applications like inventory management.
💼 Career
Database developers and administrators must choose correct data types to optimize storage and ensure data integrity.
Progress0 / 4 steps
1
Create the products table with product_id column
Write a SQL statement to create a table called products with one column named product_id of type TINYINT.
MySQL
Need a hint?

Use CREATE TABLE products (product_id TINYINT); to create the table with the product_id column.

2
Add stock_quantity column with INT type
Add a new column named stock_quantity of type INT to the products table using an ALTER TABLE statement.
MySQL
Need a hint?

Use ALTER TABLE products ADD COLUMN stock_quantity INT; to add the new column.

3
Add total_sales column with BIGINT type
Add a new column named total_sales of type BIGINT to the products table using an ALTER TABLE statement.
MySQL
Need a hint?

Use ALTER TABLE products ADD COLUMN total_sales BIGINT; to add the new column.

4
Complete the products table with all integer columns
Combine all previous steps into a single SQL script that creates the products table with product_id as TINYINT, stock_quantity as INT, and total_sales as BIGINT.
MySQL
Need a hint?

Define all columns inside one CREATE TABLE statement separated by commas.