Create a new table query
Here is an example of how to create a new table query in SQL:
CREATE TABLE Query
CREATE TABLE new_table (
column1 data_type,
column2 data_type,
column3 data_type,
...
);
Here:
CREATE TABLE
is the command to create a new table.new_table
is the name of the new table.column1
,column2
,column3
, etc. are the names of the columns in the table.data_type
is the data type of each column (e.g.int
,varchar
,date
, etc.).
For example, let's create a table called employees
with the following columns:
employee_id
(integer)name
(varchar)department
(varchar)salary
(decimal)
Here is the query:
CREATE TABLE employees (
employee_id int,
name varchar(255),
department varchar(255),
salary decimal(10, 2)
);
This query creates a new table called employees
with four columns: employee_id
, name
, department
, and salary
. The employee_id
column is an integer, the name
and department
columns are varchar (strings), and the salary
column is a decimal with a maximum of 10 digits and 2 decimal places.
Note: The data types and column names can be adjusted based on your specific needs and the requirements of your database.