2.1.1 Database Tables
You organize an application's data into tables, each representing a business entity like an employee or a department. Each column in a table corresponds to a property of that entity, like an employee's hire date or a department's location. Every column has a data type that defines the kind of information it holds, like text, numbers, or dates.
A table's primary key column uniquely identifies each row. This key lets you establish relationships between tables. By using it, you can link a row of data in one table to a related row in another. A foreign key is a column in one table that references the primary key value of another, ensuring data consistency and enforcing data integrity.
The figure below shows two tables representing the data for employees and the
departments in which they work. The EMPNO column is the
EMP table's primary key. The DEPTNO column plays
that role in the DEPT table. Both display below with a key icon. The
EMP table's DEPTNO column is a foreign key. Its
value references the primary key of the DEPT table, indicating the
department to which each employee belongs.
Figure 2-2 Two Tables with Primary Keys and Foreign Key
The APEX Builder's Quick SQL editor and Create Data Model Using AI wizard simplify creating an initial set of tables for your application, while the Object Browser makes it easy to evolve those tables over time.
Related Topics
Parent topic: Database Concepts Primer
