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

SQL · Theory

Temporary Table

← All stacks

Theory

20/439

Temporary Table

CREATE TEMPORARY TABLE tmp_fail AS SELECT * FROM students WHERE marks < 40; lives only for this connection. When you disconnect, it disappears. Other users cannot see it.

Use it for a messy report: filter, join, then SELECT from tmp. Don’t confuse with a normal table of the same name — TEMPORARY hides the real one in that session.

Trap — expecting a temporary table to still be there tomorrow.

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

Exam tip

CREATE TEMPORARY TABLE … — gone when the session ends.

Temporary Table — sample query

-- Temporary 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;

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

Short notes

  • DefTEMPORARY table lasts only for this connection.
  • RuleGood for intermediate report steps.
  • TrapThinking it is saved on disk for others.

Questions

1

Who can see a TEMPORARY table?

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