Creating a Table

Syntax: To create a table in Oracle, the following syntax is used:

CREATE TABLE table_name (
    column1 datatype [constraints],
    column2 datatype [constraints],
    ...
);

Example:

sqlCopy codeCREATE TABLE employees (
    employee_id NUMBER PRIMARY KEY,
    first_name VARCHAR2(50),
    last_name VARCHAR2(50),
    hire_date DATE,
    salary NUMBER(8, 2)
);

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *