How to create a table in Oracle database?
In Oracle database, you can use the CREATE TABLE statement to create a table. The syntax is as follows:
CREATE TABLE table_name(
column1 datatype [constraint],
column2 datatype [constraint],
...
columnN datatype [constraint]
);
In this case, table_name is the name of the table to be created, column1, column2, etc. are the names of the columns in the table, datatype represents the data type of the columns, and constraint is the optional constraint of the columns. For example, to create a table called “customers” with columns “id”, “name”, and “age”, you can use the following statement:
CREATE TABLE customers(
id INT PRIMARY KEY,
name VARCHAR(50),
age INT
);
In the above statement, the id column is defined as the primary key column, the name column is defined as VARCHAR type with a length of 50, and the age column is defined as INT type.