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

SQL · Theory

Queries

← All stacks

Theory

30/439

Queries

A query is a SQL statement that asks for or changes data. The ones you must type without thinking: SELECT, INSERT, UPDATE, DELETE. Plus CREATE for structure. People also say ‘query’ only for SELECT — in a viva, say DML vs DDL if they split hairs.

SELECT reads. INSERT adds a row. UPDATE changes a row. DELETE removes a row. Always practise SELECT with the same WHERE before UPDATE/DELETE.

Read a query in this order in your head: FROM (which table) → WHERE (which rows) → SELECT (which columns). GROUP BY / HAVING / ORDER BY come after that story.

Trap — SELECT * in every answer. Name columns. Trap: UPDATE without WHERE — whole table becomes 0 marks.

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

Exam tip

Name CRUD. Warn: no WHERE on UPDATE. Prefer listing columns.

Queries — sample query

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

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

Short notes

  • DefQuery = SQL statement. Core four: SELECT INSERT UPDATE DELETE.
  • RuleFROM → WHERE → SELECT in your head.
  • TrapUPDATE/DELETE with no WHERE.

Questions

1

What are the four data queries?

2

In what order do you read a SELECT?

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