totn Oracle Functions

Oracle / PLSQL: DDL/DML (NTH_VALUE Function)

If you have an Oracle database and want to follow along with the examples in the NTH_VALUE function tutorial, we have included the DDL and DML that you will need below.

Just follow the instructions to populate your database. Then click the following button to return to the NTH_VALUE function tutorial so that you can try the examples for yourself.

Return to Tutorial

DDL for Tutorial Examples

DDL stands for Data Definition Language and are the statements required to create the tables used in the NTH_VALUE examples.

Execute the following DDL statement in your Oracle database:

CREATE TABLE employees
( employee_id number(10) NOT NULL,
  last_name varchar2(50) NOT NULL,
  first_name varchar2(50) NOT NULL,
  salary number(10),
  dept_id number(10),
  CONSTRAINT employees_pk PRIMARY KEY (employee_id));

DML for Tutorial Examples

DML stands for Data Manipulation Language. These are the INSERT statements that you will need to run in your Oracle database to populate the data:

Execute the following DML statements in your Oracle database:

INSERT INTO employees
(employee_id, last_name, first_name, salary, dept_id)
VALUES
(1000,'Jackson','Joe',2000,10);

INSERT INTO employees
(employee_id, last_name, first_name, salary, dept_id)
VALUES
(2000,'Smith','Jane',3500,10);

INSERT INTO employees
(employee_id, last_name, first_name, salary, dept_id)
VALUES
(3000,'Ferguson','Samantha',1900,10);

INSERT INTO employees
(employee_id, last_name, first_name, salary, dept_id)
VALUES
(4000,'Reynolds','Allen',4000,20);

INSERT INTO employees
(employee_id, last_name, first_name, salary, dept_id)
VALUES
(5000,'Anderson','Paige',3250,20);

INSERT INTO employees
(employee_id, last_name, first_name, salary, dept_id)
VALUES
(6000,'Johnson','Derek',2750,20);

INSERT INTO employees
(employee_id, last_name, first_name, salary, dept_id)
VALUES
(7000,'Nelson','Sarah',5000,30);

INSERT INTO employees
(employee_id, last_name, first_name, salary, dept_id)
VALUES
(8000,'Burke','Russell',1500,30);