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
)
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)
)
No comments:
Post a Comment