1. Heap-Organized Tables: These are the most common type of tables in Oracle. They are organized as a heap, which means that data rows are stored in an unordered fashion. For example, a table named “EMPLOYEES” can be created with the following command:

CREATE TABLE employees (
employee_id INTEGER,
first_name VARCHAR2(50),
last_name VARCHAR2(50),
email VARCHAR2(50),
salary NUMBER
);

2. Index-Organized Tables: These tables are organized based on an index. This means that the data is stored in an ordered fashion based on the index key. For example, a table named “ORDERS” can be created with the following command:

CREATE TABLE orders (
order_id INTEGER,
customer_id INTEGER,
order_date DATE,
order_total NUMBER,
CONSTRAINT orders_pk PRIMARY KEY(order_id)
) ORGANIZATION INDEX;

3. Clustered Tables: These tables are organized based on a cluster key. This means that the data is stored in an ordered fashion based on the cluster key. For example, a table named “PRODUCTS” can be created with the following command:

CREATE TABLE products (
product_id INTEGER,
product_name VARCHAR2(50),
product_price NUMBER,
CONSTRAINT products_pk PRIMARY KEY(product_id)
) CLUSTER product_cluster(product_name);

4. Temporary Tables: These tables are used to store temporary data. They are usually created and populated with data for a specific purpose and then dropped when no longer needed. For example, a table named “TEMP_DATA” can be created with the following command:

CREATE GLOBAL TEMPORARY TABLE temp_data (
data_id INTEGER,
data_value VARCHAR2(50)
);

Leave a Reply

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