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

SQL · Theory

Repair Table

← All stacks

Theory

22/439

Repair Table

REPAIR TABLE is mainly for MyISAM tables that got corrupted. InnoDB almost never wants REPAIR TABLE — you use dump/restore or innodb recovery settings instead.

If a teacher’s old lab uses MyISAM and SELECT crashes, they may show REPAIR TABLE t; Don’t make it your default InnoDB answer.

Trap — REPAIR TABLE on InnoDB and thinking it ‘optimises’ like OPTIMIZE TABLE.

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

Exam tip

MyISAM: REPAIR TABLE. InnoDB: don’t; restore from backup.

Repair Table — sample query

-- Repair Table
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;

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

Short notes

  • DefREPAIR TABLE is a MyISAM recovery command.
  • RuleInnoDB → dump/restore, not REPAIR.
  • TrapUsing REPAIR on InnoDB as a habit.

Questions

1

When is REPAIR TABLE used?

22 / 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.