MainMenu

Home Java Overview Maven Tutorials

Sunday 15 January 2017

SQL query to create database and table.

SQL Query to create database.

Syntax :

Create Database database_Name


Example : Create Database Chandan
Now a database of name Chandan will be created.

SQl Query to create table in database.


Syntax :

Create Table database_name.table_name
(Column_name data_type,
Column_name data_type,
Column_name data_type
)

Example :
Create Table Chandan.Salary
(
Emp_id Int(10) PRIMARY KEY,
Emp_name Varchar(50),
Emp_salary Int(20)
)
Now a table of name Salary will be created with in Chandan database
Note : if you are inside the data base then in query database name is not required. if you are already with in Chandan database then
Example :
Create Table Salary
(
Emp_id Int(10) PRIMARY KEY,
Emp_name Varchar(50),
Emp_salary Int(20)
)

Tag :How to create database with example?,How to create table with example?

No comments:

Post a Comment