My Hands-On Journey with Oracle Live SQL: Learning by Doing
Hey devs!
I recently started exploring Oracle’s Live SQL platform to level up my database skills, and I wanted to share some of my learnings, code snippets, and a few surprises I ran into. If you're diving into SQL or curious about Oracle's ecosystem, this post might be just what you need.
What Is Oracle Live SQL?
Oracle Live SQL is a browser-based SQL playground—no installation required. You can write, run, and test SQL and PL/SQL scripts instantly. It’s perfect for learners, hobbyists, and pros who want to prototype or practice.
What I Built
- Creating Tables and Inserting Data sql CREATE TABLE EMPLOYEE ( EmpID NUMBER, EmpName VARCHAR2(50), EmpAge NUMBER, EmpSalary NUMBER );
INSERT INTO EMPLOYEE VALUES (101, 'John', 25, 50000);
INSERT INTO EMPLOYEE VALUES (102, 'Jane', 30, 60000);
Filtering with WHERE Clause
sql
SELECT employee_id, first_name, salary
FROM employees
WHERE salary > 50000;
Heads-up: The output included salaries below 50,000—possibly a data issue or caching quirk.-
PL/SQL Scripting with Conditional Logic
sql
SET SERVEROUTPUT ON;
DECLARE
v_emp_salary NUMBER;
BEGIN
SELECT salary INTO v_emp_salary FROM employees WHERE employee_id = 100;IF v_emp_salary > 5000 THEN
DBMS_OUTPUT.PUT_LINE('Very Good Salary: ' || v_emp_salary);
ELSE
DBMS_OUTPUT.PUT_LINE('Average Salary: ' || v_emp_salary);
END IF;
END; Triggers for Auditing
sql
CREATE OR REPLACE TRIGGER STUDENT_AUDIT
AFTER INSERT ON STUDENTS
FOR EACH ROW
BEGIN
INSERT INTO AUDIT_LOG (Student_ID, Action, ActionDate)
VALUES (:NEW.Student_ID, 'INSERT', SYSDATE);
END;
Top comments (0)