SELECT UPPER(last_name) AS employee_name, ROUND(salary, -3) AS rounded_salary, MONTHS_BETWEEN(SYSDATE, hire_date) AS months_employed FROM employees; Use code with caution. 3. Fundamentals of PL/SQL Programming

CREATE OR REPLACE FUNCTION get_annual_tax ( p_emp_id IN NUMBER ) RETURN NUMBER AS v_salary employees.salary%TYPE; v_tax NUMBER(10,2); BEGIN SELECT salary INTO v_salary FROM employees WHERE employee_id = p_emp_id; v_tax := v_salary * 0.15; RETURN v_tax; END get_annual_tax; / Use code with caution. 7. Advanced Database Objects: Triggers and Packages Database Triggers

Joins combine columns from multiple tables, while subqueries nest one query inside another for advanced filtering.

Subprograms are named, compiled PL/SQL blocks stored in the database. They promote code reuse, simplify maintenance, and enforce security boundaries. Stored Procedure Example