PGoCareerGoCareer prep tools
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

SQL · Theory

Show Indexes

← All stacks

Theory

79/439

Show Indexes

SHOW INDEX FROM students; lists indexes, columns, uniqueness, cardinality. Key_name PRIMARY is the PK.

EXPLAIN still answers ‘will this query use it?’. SHOW INDEX answers ‘what exists?’.

Trap — looking at cardinality 2 on a boolean and expecting miracles.

On the example next to this theory: Show Indexes: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Exam tip

SHOW INDEX FROM students;

Show Indexes — sample query

-- Show Indexes
CREATE TABLE demo (
  id INTEGER PRIMARY KEY,
  label TEXT NOT NULL,
  qty INTEGER DEFAULT 0
);
INSERT INTO demo (id, label, qty) VALUES
  (1, 'alpha', 2),
  (2, 'beta', 5);
SELECT label, qty FROM demo WHERE qty >= 2 ORDER BY qty DESC;

Show Indexes: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Short notes

  • DefSHOW INDEX FROM t; lists indexes.
  • RulePRIMARY is an index too.
  • TrapHigh hopes on low-cardinality indexes.

Questions

1

How do you list indexes?

79 / 439

P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.