Sobes.tech
Junior — Middle

What index is automatically created when creating a table in a database by default?

sobes.tech AI

Answer from AI

By default, when creating a table in most relational databases, an index on the primary key (PRIMARY KEY) is automatically created. This index ensures the uniqueness of the values in the primary key column(s) and speeds up search and join operations.

For example, in SQL:

CREATE TABLE users (
    id INT PRIMARY KEY,
    name VARCHAR(100)
);

In this case, a unique index on the id column is automatically created.

If the primary key is not specified, an index is usually not created by default, but this depends on the specific DBMS.

What index is automatically created when creating a… - sobes.tech