TestForge | Aidevops | 📊 Plogger ✍️ Blog 📚 Docs
plogger

AI DevOps Korea

Turn AI service development and operations into one improvement loop

Aidevops.kr covers LLMOps, RAG, agents, observability, evaluation, and cost-performance optimization for production AI services.

Oracle vs. MySQL Differences — Syntax, Functions, and Sequences

Oracle vs. MySQL Differences — Syntax, Functions, and Sequences diagram
Visual guide to the key flow, architecture, and decision points covered in this post.
## Key Differences
ItemOracleMySQL
Auto incrementSEQUENCEAUTO_INCREMENT
String concatenation||CONCAT()
NULL handlingNVL()IFNULL() / COALESCE()
PaginationROWNUM / FETCH FIRSTLIMIT / OFFSET
Date functionSYSDATENOW()
Empty stringSame as NULLDifferent from NULL

Auto-Increment Keys

-- Oracle
CREATE SEQUENCE user_seq START WITH 1 INCREMENT BY 1;
INSERT INTO users VALUES (user_seq.NEXTVAL, 'Hoon');

-- MySQL
CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50)
);
INSERT INTO users (name) VALUES ('Hoon');

Pagination Queries

-- Oracle 12c+
SELECT * FROM posts
ORDER BY created_at DESC
OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY;

-- Oracle 11g and earlier
SELECT * FROM (
    SELECT ROWNUM rn, t.* FROM (
        SELECT * FROM posts ORDER BY created_at DESC
    ) t WHERE ROWNUM <= 10
) WHERE rn > 0;

-- MySQL
SELECT * FROM posts ORDER BY created_at DESC LIMIT 10 OFFSET 0;

NULL Handling

-- Oracle
SELECT NVL(phone, '미등록') FROM users;
SELECT NVL2(phone, '있음', '없음') FROM users;

-- MySQL
SELECT IFNULL(phone, '미등록') FROM users;
SELECT IF(phone IS NOT NULL, '있음', '없음') FROM users;

-- Common (ANSI SQL)
SELECT COALESCE(phone, mobile, '미등록') FROM users;

Date Handling

-- Oracle
SELECT SYSDATE, TRUNC(SYSDATE), TO_CHAR(SYSDATE, 'YYYY-MM-DD') FROM DUAL;
SELECT ADD_MONTHS(SYSDATE, 1) FROM DUAL;

-- MySQL
SELECT NOW(), DATE(NOW()), DATE_FORMAT(NOW(), '%Y-%m-%d');
SELECT DATE_ADD(NOW(), INTERVAL 1 MONTH);

MERGE / UPSERT

-- Oracle MERGE
MERGE INTO users t USING (SELECT 1 id, 'Hoon' name FROM DUAL) s
ON (t.id = s.id)
WHEN MATCHED THEN UPDATE SET t.name = s.name
WHEN NOT MATCHED THEN INSERT VALUES (s.id, s.name);

-- MySQL
INSERT INTO users (id, name) VALUES (1, 'Hoon')
ON DUPLICATE KEY UPDATE name = VALUES(name);

What Gets Hard in Production

  • Oracle and MySQL differ not only in features but in operational assumptions, licensing, tooling culture, and enterprise fit.
  • The wrong comparison asks which database is “better” in general instead of which risk profile and workload each one supports.
  • Migration cost can outweigh feature gain if surrounding expertise is ignored.

Architecture Decisions That Matter

  • Evaluate by workload criticality, operational maturity, ecosystem fit, and budget constraints.
  • Include backup, HA, observability, and DBA skill depth in the decision, not just SQL feature lists.
  • Treat vendor posture and long-term support expectations as architecture inputs.

Practical Example

A practical selection matrix often looks like this:

Oracle -> large enterprise controls, mature DBA operations, complex legacy integration
MySQL -> broad commodity ecosystem, lower cost sensitivity, simpler operational footprint

Anti-Patterns to Avoid

  • Comparing only benchmark headlines.
  • Ignoring licensing and operational staffing realities.
  • Assuming migration is mainly about SQL syntax compatibility.

Operational Checklist

  • List non-functional requirements before feature comparison.
  • Estimate migration effort beyond schema conversion.
  • Assess backup, failover, and monitoring tooling readiness.
  • Review available team expertise honestly.

Final Judgment

Oracle versus MySQL is a context decision, not a universal ranking. The better choice is the one whose operational and business model the organization can actually sustain.

Continue Reading

Related posts

Next Path

Keep exploring this topic as a system