Suggest an editImprove this articleRefine the answer for “How do you create an index in SQL?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)To create an index in SQL, use the `CREATE INDEX` command, specifying the index name, the table, and the columns it's built on, e.g. `CREATE INDEX idx_users_email ON users (email)`; you can index several columns at once (a composite index) or create a unique index with `CREATE UNIQUE INDEX`. **Key point:** indexes speed up `SELECT`, but slow down `INSERT`, `UPDATE`, and `DELETE` a bit; the index name is arbitrary, but it's conventional to include the table and column names in it.Shown above the full answer for quick recall.Answer (EN)ImageTo create an index in SQL, use the `CREATE INDEX` command. It specifies the index name, the table, and the columns it's built on. ### The simplest syntax ```sql CREATE INDEX index_name ON table_name (column); ``` ### Example ```sql CREATE INDEX idx_users_email ON users (email); ``` Creates an index named `idx_users_email` on the `email` column of the `users` table. You can index several columns at once: ```sql CREATE INDEX idx_orders_customer_date ON orders (customer_id, order_date); ``` This is a composite index. If you need uniqueness (to prevent duplicates): ```sql CREATE UNIQUE INDEX idx_users_username ON users (username); ``` ### Important - Indexes speed up `SELECT`, but slow down `INSERT`, `UPDATE`, `DELETE` a bit. - The index name (`idx_...`) is arbitrary, but it's conventional to include the table and column names.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.