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

SQL · Theory

IS NULL

← All stacks

Theory

56/439

IS NULL

NULL means unknown / missing. WHERE marks IS NULL; students who have no marks yet. 0 is a real number. '' is an empty string. They are not NULL.

Any maths with NULL becomes NULL: marks + 1 is NULL if marks is NULL. IFNULL(marks, 0) or COALESCE(marks, 0) fills a default in the SELECT.

INSERT without a value into a nullable column stores NULL. NOT NULL columns reject that.

Trap — WHERE marks = NULL — always unknown, returns no rows. Trap: COUNT(marks) skips NULL; COUNT(*) counts rows.

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

Exam tip

WHERE marks IS NULL; COALESCE(marks, 0).

IS NULL — sample query

-- IS NULL
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;

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

Short notes

  • DefNULL = unknown. Test with IS NULL.
  • RuleNever = NULL. COALESCE / IFNULL for a default.
  • TrapMixing NULL, 0, and ''.

Questions

1

How do you find missing marks?

2

Why not = NULL?

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