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

SQL · Theory

BETWEEN

← All stacks

Theory

58/439

BETWEEN

BETWEEN is inclusive on both ends. WHERE marks BETWEEN 40 AND 60 means marks >= 40 AND marks <= 60. Swap 60 AND 40 and you get empty — low first.

Works for DATE — WHERE dob BETWEEN '2004-01-01' AND '2004-12-31'. Quote dates.

Trap — thinking BETWEEN is exclusive. Trap: BETWEEN on a timestamp and missing the time part (00:00:00).

On the example next to this theory — BETWEEN — wHERE combines predicates with AND/OR; LIKE does pattern match.

Exam tip

WHERE marks BETWEEN 40 AND 60; → 40 and 60 both in.

BETWEEN — sample query

CREATE TABLE products (id INTEGER PRIMARY KEY, name TEXT, price REAL);
INSERT INTO products VALUES (1, 'Pen', 10), (2, 'Book', 200), (3, 'Bag', 50);
SELECT * FROM products
WHERE price BETWEEN 20 AND 150 AND name LIKE 'B%';

BETWEEN — wHERE combines predicates with AND/OR; LIKE does pattern match.

Short notes

  • DefBETWEEN a AND b is inclusive on both sides.
  • RuleSmaller value first. Quote dates.
  • TrapExclusive-range thinking. Backwards range.

Questions

1

Is BETWEEN inclusive?

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