⚡ 180+ new openings posted today

CREATE TABLE SQL Statement

How to Create a Table in SQL ?

Answer : The CREATE TABLE statement is used to create a new table in a database.

Syntax

The basic syntax of CREATE TABLE statement is as follows :

CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype
);

CREATE TABLE : This is the keyword telling the database system what you want to do.

table_name : name of the table

column[1,2,3] : name of the column.

data_type : Type of data we want to store in the particular column.

Example :

CREATE TABLE Employees (
Employee_ID INT,
Employee_Name VARCHAR(100),
Salary DECIMAL(10,2)
);

Each column stores a specific type of value:

  • Employee_ID → INT
    Stores whole numbers (integers).
    Example: 101102103
  • Employee_Name → VARCHAR(100)
    Stores text/string values with a maximum length of 100 characters.
    Example: 'Anjali''Priya''Amit'
  • Salary → DECIMAL(10,2)
    Stores numbers with decimal values. Here, 10 is the maximum total number of digits and 2 is the number of digits after the decimal point.
    Example: 50000.5045000.75

Employees Table

Employee_IDEmployee_NameSalary
INTVARCHAR(100)DECIMAL(10,2)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top