OracleEach row of data in a database’s table has a unique identifier called
OracleIt is often used internally to access data.
MySQLThere is a similar hidden column in
_rowidTo mark a unique identity. But we need to pay attention
_rowidIt’s not a real column, its essence is aNon empty unique columnAlias.
PS: This article is based on
_What is ROWID
As mentioned earlier
_rowidIt’s not a real column, its essence is aNon empty unique columnAlias. Why do you say that?
Because in some cases
_rowidIt does not exist. It only exists in the following situations:
- When there is aNumeric typeWhen the single column primary key of,
_rowidIn fact, it refers to the primary key column
- When in the tablePrimary key does not existBut there is oneNumeric typeOfNon empty unique columnAt that time,
_rowidIn fact, it means correspondenceNon empty unique column。
It should be noted that the following situations do not exist
- Primary key columnperhapsNon empty unique columnThe type of is notNumeric type
- Primary keyIs the union primary key
- OnlyColumn is not non empty.
For details, please refer to
MySQLOfficial document content:
If a table has a PRIMARY KEY or UNIQUE NOT NULL index that consists of a single column that has an integer type, you can use _rowid to refer to the indexed column in SELECT statements, as follows:
- _rowid refers to the PRIMARY KEY column if there is a PRIMARY KEY consisting of a single integer column. If there is a PRIMARY KEY but it does not consist of a single integer column, _rowid cannot be used.
- Otherwise, _rowid refers to the column in the first UNIQUE NOT NULL index if that index consists of a single integer column. If the first UNIQUE NOT NULL index does not consist of a single integer column, _rowid cannot be used.
- 13.1.14 CREATE INDEX Syntax
- Re: Oracle ROWID equivalent in MySQL