CREATE TABLE

To create a table in a database, we specify a table name, column name and there  datatypes.

Syntax:

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

Example: To create a table named students containing ‘Roll no.’, Name and Total Marks.

CREATE TABLE students (
    Roll_No int,
    Name varchar(100),
    Total_Marks int
    );

A table of student will be created having ‘Roll_No’ and Total_Marks of integer type, Name as character type which can contain 100 characters.

The table can be seen by using SELECT statement.

(We will learn SELECT Statement in later section)

Syntax:

SELECT * FROM table_name;

Example:

SELECT * FROM students;

This will give the following output:

Now, the data can be inserted into table using INSERT INTO statement.