A table in a database is a collection of two-dimensional arrays that represent and store relationships between data objects. This topic describes the database objects and the features related to tables, including table storage, table compression, table groups, and temporary tables.
In databases, tables are the basic units for organizing data. A table consists of rows and columns. For example, a table named "Author" stores information about authors. Each column in the table contains a specific type of information about all authors, such as last names. Each row contains information about a specific author, such as last names, first names, and addresses. In most cases, a table has a fixed number of columns, which are identified by column names. The number of rows can change dynamically. The number of rows can change dynamically.
Tables can be classified into ordinary tables and temporary tables. In the Oracle mode of OceanBase Database, temporary tables are similar to ordinary tables in terms of lifecycle. A temporary table created is visible to all sessions (session) and will be cleared only after an explicit DROP command is executed. As a result, temporary tables occupy the name space of ordinary tables. The name of an object cannot be the same as that of a temporary table, and a temporary table will not be moved to the recycle bin after it is dropped.
Temporary tables support data cleanup strategies at both the session and transaction levels. At the session level, each session saves a copy of the data of a temporary table. The data of different sessions does not interfere with each other. The data of a session is cleared when the session is closed. At the transaction level, the data of a temporary table is cleared when the transaction is committed.
Columns
In a database, a column (Column) records the values of a specific attribute of the data in a table. The name given by the user to an attribute is the column name. In addition to the column name, a column also has information such as the data type and the maximum length (precision) of the data type.
In addition to regular columns, OceanBase Database in Oracle mode also supports virtual columns (or generated columns) and invisible columns.
Unlike regular columns, virtual columns do not have physical storage space. The results for a virtual column are calculated based on an expression or function defined by the user on the virtual column.
Invisible columns are not displayed unless the user specifies the column name in the query statement. If SELECT * is used to query table data, invisible columns are not displayed. Invisible columns are often used for data migration or to extend the functionality of existing applications.
Rows
In a database, a row (Row) is a collection of data in all columns of a single record. In other words, a database can be considered to consist of rows and columns. Each row in a table represents a group of related data, and all rows in a table have the same structure.
For example, a data table related to company information contains rows that represent different companies. The columns may contain information such as the company name, street address, and VAT number.