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

SQL · Theory

OR

← All stacks

Theory

47/439

OR

OR means at least one condition true. WHERE city = 'Pune' OR city = 'Goa'; Same idea as city IN ('Pune','Goa') — IN is cleaner for a list.

AND is evaluated before OR if you skip brackets. WHERE city = 'Pune' OR city = 'Goa' AND marks < 40 is not ‘(Pune or Goa) and fail’. Write brackets every time.

Trap — OR with a NULL-safe thought missing. Trap: huge OR lists instead of IN or a lookup table.

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

Exam tip

WHERE city IN ('Pune','Goa'); or OR with brackets.

OR — 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%';

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

Short notes

  • DefOR = either condition can be true.
  • RuleAlways bracket OR with AND. Prefer IN for lists.
  • TrapForgetting AND binds tighter than OR.

Questions

1

Pune or Goa students?

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