Introduction
Creating tables using the Object Browser in Oracle APEX is a quick and user-friendly way to define and manage your database structure without writing SQL code manually. The Object Browser provides a visual interface where you can easily create tables, define columns, set data types, add constraints, and manage keys—all from within your web browser. This is especially helpful for developers who want to focus on application logic while handling basic database tasks efficiently.
Creating Tables Using the Object Browser in Oracle APEX
Oracle APEX provides a built-in Object Browser tool that lets you visually create and manage tables without writing SQL code. This is especially helpful for rapid development, prototyping, or for users who prefer a guided interface to define their data structures. Using the Object Browser, you can set up columns, define data types, apply constraints, and configure primary keys—all within a few clicks.
Accessing the Object Browser
-
Log in to your Oracle APEX workspace.
-
From the APEX home screen, go to SQL Workshop.
-
Click on Object Browser.
-
You’ll see a list of existing database objects on the left panel, including tables, views, indexes, and more.
Creating a New Table
-
In the Object Browser toolbar, click Create.
-
Select Table from the list of options.
-
Enter a name for your new table. Use uppercase (e.g.,
EMPLOYEES
) to follow common Oracle naming standards. -
Click Next to begin defining your columns.
Defining Table Columns
For each column, you need to specify several properties:
-
Column Name (e.g.,
EMP_ID
,FIRST_NAME
,SALARY
) -
Data Type
-
VARCHAR2(size)
for text -
NUMBER(p,s)
for numeric values -
DATE
for date fields -
CLOB
for large text content
-
-
Primary Key checkbox if the column will uniquely identify records
-
Not Null checkbox if the column should always have a value
-
Default Value (optional)
Example Column Configuration
Column Name | Data Type | Primary Key | Not Null | Default Value |
---|---|---|---|---|
EMP_ID | NUMBER(10) | Yes | Yes | Auto-increment |
FIRST_NAME | VARCHAR2(50) | No | Yes | — |
LAST_NAME | VARCHAR2(50) | No | Yes | — |
SALARY | NUMBER(8,2) | No | No | 0.00 |
HIRE_DATE | DATE | No | No | SYSDATE |
You can add as many columns as needed. Click Add Column to continue adding fields.
Setting Primary Keys and Constraints
-
Use the checkbox next to a column to set it as the Primary Key.
-
If using an auto-incrementing ID, select Identity Column for the ID field.
-
Click Constraints if you want to apply advanced rules:
-
Unique: Ensure column values are not duplicated.
-
Check: Define a condition (e.g.,
SALARY > 0
). -
Foreign Key: Link a column to a key in another table.
-
Saving the Table
-
After defining all fields and constraints, click Next.
-
Review the structure summary.
-
Click Create to build the table.
Your new table will now be listed in the Object Browser.
Verifying the Table
To confirm that the table was created correctly:
-
Click on the table name in the Object Browser.
-
Click the Columns tab to inspect the structure.
-
Click the Data tab to view or insert sample records.
Using the Object Browser makes it easy to define and manage your database schema directly in Oracle APEX, without writing a single line of SQL. It’s a powerful tool for developers who want a fast and clear way to build tables and enforce data rules.
Inserting Data into the Table
You can manually add records using the Data tab in the Object Browser:
Click on Data.
Click Insert Row.
Enter values for each column.
Click Apply Changes.
Alternatively, use SQL Commands in SQL Workshop:
INSERT INTO EMPLOYEES (EMP_ID, FIRST_NAME, LAST_NAME, SALARY, HIRE_DATE)
VALUES (1, 'John', 'Doe', 50000, SYSDATE);
Modifying an Existing Table
To modify a table after creation:
In Object Browser, select the table.
Click Edit to add, remove, or modify columns.
Click Apply Changes when finished.
Example Modifications:
Adding a new column:
ALTER TABLE EMPLOYEES ADD DEPARTMENT_ID NUMBER(5);
Modifying a column's data type:
ALTER TABLE EMPLOYEES MODIFY SALARY NUMBER(10,2);
Dropping a column:
ALTER TABLE EMPLOYEES DROP COLUMN DEPARTMENT_ID;
Best Practices
Use meaningful table and column names for readability.
Define constraints to ensure data integrity.
Use appropriate data types to optimize storage and performance.
Test queries in SQL Workshop before applying changes.
The Object Browser in Oracle APEX provides an easy way to create and manage database tables.
You can define columns, constraints, and relationships without writing SQL.
Data can be inserted manually or using SQL commands.
The table structure can be modified as needed.
This method is ideal for developers who prefer a graphical interface for database management while still maintaining full control over their schema.
DATA for CREATING TABLE
Create Table “Persons”
CREATE TABLE Persons (
First_Name VARCHAR(50),
Last_Name VARCHAR(50),
Address VARCHAR(100),
City VARCHAR(50),
Name_Of_State VARCHAR(50),
ZIPcode VARCHAR(10)
);
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('John', 'Doe', '123 Main St', 'Springfield', 'California'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('Jane', 'Smith', '456 Oak Ave', 'Denver', 'Colorado'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('Michael', 'Johnson', '789 Pine Rd', 'Austin', 'Texas'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('Emily', 'Davis', '101 Maple Ln', 'Seattle', 'Washington'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('Robert', 'Brown', '202 Birch Blvd', 'Miami', 'Florida'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('Sarah', 'Miller', '303 Cedar Ct', 'Chicago', 'Illinois'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('David', 'Wilson', '404 Elm Dr', 'New York', 'New York'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('Jessica', 'Moore', '505 Spruce Way', 'Portland', 'Oregon'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('Daniel', 'Taylor', '606 Aspen Pl', 'Atlanta', 'Georgia'); COMMIT;
INSERT INTO Persons (First_Name, Last_Name, Address, City, Name_Of_State) VALUES ('Laura', 'Anderson', '707 Walnut St', 'Phoenix', 'Arizona'); COMMIT;
CREATE TABLE States (
state_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
state_name VARCHAR2(50) NOT NULL,
state_code CHAR(2) NOT NULL UNIQUE
);
INSERT INTO States (state_name, state_code) VALUES ('Alabama', 'AL');
INSERT INTO States (state_name, state_code) VALUES ('Alaska', 'AK');
INSERT INTO States (state_name, state_code) VALUES ('Arizona', 'AZ');
INSERT INTO States (state_name, state_code) VALUES ('Arkansas', 'AR');
INSERT INTO States (state_name, state_code) VALUES ('California', 'CA');
INSERT INTO States (state_name, state_code) VALUES ('Colorado', 'CO');
INSERT INTO States (state_name, state_code) VALUES ('Connecticut', 'CT');
INSERT INTO States (state_name, state_code) VALUES ('Delaware', 'DE');
INSERT INTO States (state_name, state_code) VALUES ('Florida', 'FL');
INSERT INTO States (state_name, state_code) VALUES ('Georgia', 'GA');
INSERT INTO States (state_name, state_code) VALUES ('Hawaii', 'HI');
INSERT INTO States (state_name, state_code) VALUES ('Idaho', 'ID');
INSERT INTO States (state_name, state_code) VALUES ('Illinois', 'IL');
INSERT INTO States (state_name, state_code) VALUES ('Indiana', 'IN');
INSERT INTO States (state_name, state_code) VALUES ('Iowa', 'IA');
INSERT INTO States (state_name, state_code) VALUES ('Kansas', 'KS');
INSERT INTO States (state_name, state_code) VALUES ('Kentucky', 'KY');
INSERT INTO States (state_name, state_code) VALUES ('Louisiana', 'LA');
INSERT INTO States (state_name, state_code) VALUES ('Maine', 'ME');
INSERT INTO States (state_name, state_code) VALUES ('Maryland', 'MD');
INSERT INTO States (state_name, state_code) VALUES ('Massachusetts', 'MA');
INSERT INTO States (state_name, state_code) VALUES ('Michigan', 'MI');
INSERT INTO States (state_name, state_code) VALUES ('Minnesota', 'MN');
INSERT INTO States (state_name, state_code) VALUES ('Mississippi', 'MS');
INSERT INTO States (state_name, state_code) VALUES ('Missouri', 'MO');
INSERT INTO States (state_name, state_code) VALUES ('Montana', 'MT');
INSERT INTO States (state_name, state_code) VALUES ('Nebraska', 'NE');
INSERT INTO States (state_name, state_code) VALUES ('Nevada', 'NV');
INSERT INTO States (state_name, state_code) VALUES ('New Hampshire', 'NH');
INSERT INTO States (state_name, state_code) VALUES ('New Jersey', 'NJ');
INSERT INTO States (state_name, state_code) VALUES ('New Mexico', 'NM');
INSERT INTO States (state_name, state_code) VALUES ('New York', 'NY');
INSERT INTO States (state_name, state_code) VALUES ('North Carolina', 'NC');
INSERT INTO States (state_name, state_code) VALUES ('North Dakota', 'ND');
INSERT INTO States (state_name, state_code) VALUES ('Ohio', 'OH');
INSERT INTO States (state_name, state_code) VALUES ('Oklahoma', 'OK');
INSERT INTO States (state_name, state_code) VALUES ('Oregon', 'OR');
INSERT INTO States (state_name, state_code) VALUES ('Pennsylvania', 'PA');
INSERT INTO States (state_name, state_code) VALUES ('Rhode Island', 'RI');
INSERT INTO States (state_name, state_code) VALUES ('South Carolina', 'SC');
INSERT INTO States (state_name, state_code) VALUES ('South Dakota', 'SD');
INSERT INTO States (state_name, state_code) VALUES ('Tennessee', 'TN');
INSERT INTO States (state_name, state_code) VALUES ('Texas', 'TX');
INSERT INTO States (state_name, state_code) VALUES ('Utah', 'UT');
INSERT INTO States (state_name, state_code) VALUES ('Vermont', 'VT');
INSERT INTO States (state_name, state_code) VALUES ('Virginia', 'VA');
INSERT INTO States (state_name, state_code) VALUES ('Washington', 'WA');
INSERT INTO States (state_name, state_code) VALUES ('West Virginia', 'WV');
INSERT INTO States (state_name, state_code) VALUES ('Wisconsin', 'WI');
INSERT INTO States (state_name, state_code) VALUES ('Wyoming', 'WY');
Conclusion
The Object Browser in Oracle APEX offers a simple yet powerful way to create and manage database tables. Whether you're building a new application or expanding an existing one, the visual tools allow you to quickly set up tables with all the necessary fields and constraints. It’s an excellent option for both beginners and experienced users who want to streamline their development workflow without switching between environments.