A database table is a collection of two-dimensional arrays that represents and stores relationships between data objects. This topic describes the database objects in tables and the features of tables, including table storage, table compression, table groups, and temporary tables.
A table is the basic unit of data organization in a database. It consists of vertical columns and horizontal rows. For example, a table that stores author information is named Author. Each column in the table contains a specific type of information of all authors, such as last names. Each row contains all information of a specified author, such as the first name, last name, and address. The number of columns in a table is specified when the table is created, and the columns are identified by column names. The number of rows can dynamically change.
Tables are classified into normal and temporary tables. In OceanBase Database in Oracle mode, the lifecycle of a temporary table is the same as that of a normal table. After a temporary table is created, it becomes visible to any sessions (session/sess), and you can clear it only by explicitly running the DROP command. Temporary tables occupy namespaces of normal tables. Therefore, object names in temporary tables must be different from those in normal tables. After you run the DROP command on a temporary table, it is cleared without entering the recycle bin.
Session- and transaction-level data clearance strategies are defined for temporary tables. A session-level temporary table stores data of the specific session, and the data is cleared when the session is disconnected. Session-level temporary tables of different sessions are independent of each other. Data in a transaction-level temporary table is cleared when the transaction is committed.
Columns
In a database, a column in a table records the values of an attribute field, and the attribute name is the column name. In addition to the column name, the column also contains the data type and the maximum length (precision) of the data type.
In addition to normal columns, OceanBase Database in Oracle mode also supports virtual columns (also known as generated columns) and invisible columns.
In contrast to a normal column, a virtual column does not have a real physical storage space, and results are calculated based on an expression or function that you define on the virtual column during a query.
An invisible column is displayed only when you explicitly specify the column name during a query. If you execute the SELECT * statement to query data in a table, invisible columns are not displayed. Invisible columns are often used to migrate data or extend the features of published applications.
Rows
In a database, a row in a table is a collection of data from all columns in a single record. In simple terms, a database can be thought of as consisting of columns and rows. Each row in a table represents a set of related data, and all rows have the same structure.
For example, in a data table that records company information, each row represents a company, and corresponding columns can represent the company name, address, and tax number.