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

SQL · Theory

DATE_ADD()

← All stacks

Theory

218/439

DATE_ADD()

DATE_ADD() (DATE_ADD) is a MySQL date/time helper. Dates are stored in DATE / DATETIME / TIMESTAMP columns. Always quote literals: '2026-08-19'.

Typical pattern: SELECT DATE_ADD(…); or SELECT DATE_ADD(dob) FROM students; NOW() / CURDATE() / CURTIME() have empty brackets — they read the clock.

DATE_FORMAT(dob, '%d-%b-%Y') is for display. DATEDIFF(end, start) is days between. INTERVAL 7 DAY is how you add a week: DATE_ADD(CURDATE(), INTERVAL 7 DAY).

Trap: comparing dates as VARCHAR. Trap: TIMESTAMP vs DATETIME timezone stories — DATETIME is ‘wall clock’, TIMESTAMP is UTC-stored (say this only if asked).

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

Exam tip

DATE_ADD: one SELECT example. Quote 'YYYY-MM-DD'.

DATE_ADD() — sample query

-- DATE_ADD()
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;

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

Short notes

  • DefDATE_ADD works on DATE/DATETIME values.
  • RuleQuote date literals. NOW() for current datetime.
  • TrapDates as strings without a real DATE column.

Questions

1

What is DATE_ADD?

2

Current datetime?

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