0
0
SQLquery~30 mins

Column data types (INT, VARCHAR, DATE, DECIMAL) in SQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Create a Customer Orders Table with Correct Column Data Types
📖 Scenario: You are working for an online store. You need to create a table to store customer orders. Each order has an ID, customer name, order date, and total amount.
🎯 Goal: Create a SQL table called CustomerOrders with columns using the correct data types: an integer for order ID, a string for customer name, a date for order date, and a decimal for total amount.
📋 What You'll Learn
Create a table named CustomerOrders
Add a column OrderID with data type INT
Add a column CustomerName with data type VARCHAR(100)
Add a column OrderDate with data type DATE
Add a column TotalAmount with data type DECIMAL(10, 2)
💡 Why This Matters
🌍 Real World
Online stores and many business applications use tables like CustomerOrders to keep track of sales and customer information.
💼 Career
Knowing how to define tables with correct data types is essential for database design and management roles.
Progress0 / 4 steps
1
Create the table structure
Write a SQL statement to create a table called CustomerOrders with columns OrderID, CustomerName, OrderDate, and TotalAmount. Do not specify data types yet.
SQL
Need a hint?

Start by writing CREATE TABLE CustomerOrders ( and list the column names separated by commas.

2
Add data types for integer and string columns
Modify the CustomerOrders table creation to set OrderID as INT and CustomerName as VARCHAR(100).
SQL
Need a hint?

Use INT for OrderID and VARCHAR(100) for CustomerName.

3
Add data types for date and decimal columns
Add the data types DATE for OrderDate and DECIMAL(10, 2) for TotalAmount in the CustomerOrders table.
SQL
Need a hint?

Use DATE for OrderDate and DECIMAL(10, 2) for TotalAmount.

4
Complete the table creation with all data types
Ensure the CustomerOrders table is created with all columns and their correct data types: OrderID INT, CustomerName VARCHAR(100), OrderDate DATE, and TotalAmount DECIMAL(10, 2).
SQL
Need a hint?

Double-check that all columns have the correct data types and the syntax is correct.