Create Query:




The Create Command

Through the create command we can create a table or a database in the SQL. The create command is a DDL command.




Creating a Database

To create a database in RDBMS, the create database statement is used. The syntax for this is given below:

 

SYNTAX

CREATE DATABASE database-name;

Where database-name can be any name of database by user.

EXAMPLE

Suppose you want to create a database that is named as db1 then you will use the following statement:

Create database db1;

This statement will create a database that is named as db1.

 

Creating a table

To create a table in a database, the create table statement is used. The syntax for this is given below:

CREATE TABLE table-name

{

Column-name datatype1,

Column-name datatype2,

Column-name datatype3,

};

This will create a table in the database of given name and the column details.




EXAMPLE

Create table student (STUD_ID int, name varchar, MONFEE int);