create command

create command

create is a DDL command used to create a table or a database.


Creating a Database

To create a database in RDBMS, create command is uses. Following is the Syntax,

create database database-name;

Example for Creating Database

create database Test;

The above command will create a database named Test.


Creating a Table

create command is also used to create a table. We can specify names and datatypes of various columns along.Following is the Syntax,

create table table-name
{
 column-name1 datatype1,
 column-name2 datatype2,
 column-name3 datatype3,
 column-name4 datatype4
};

create table command will tell the database system to create a new table with given table name and column information.


Example for creating Table

create table Student(id int, name varchar, age int);

The above command will create a new table Student in database system with 3 columns, namely id, name and age.