Oracle Database Setup

SQL Simulator Setup

The first thing you will need to do is to set up blank schema for the SQL Simulator to run in. It is important that you set this blank schema up in a non production database. Use the below script for this task:

create user sql_simulator_1 identified by password;
grant create session to sql_simulator_1;
grant dba  to sql_simulator_1;

Next please run the following in a different database than the one you used to create the sql_simulator_1 schema.

CREATE TABLE employees
( employee_id int NOT NULL PRIMARY KEY,
  employee_ssn varchar2(9) NOT NULL,
  employee_first_name varchar2(50) NOT NULL,
  employee_last_name varchar2(50) NOT NULL,
  employee_address varchar2(50) NOT NULL,
  city varchar2(50),
  state varchar2(50),
  zip varchar2(50)
);


CREATE TABLE payroll (
    payroll_id int NOT NULL PRIMARY KEY,	
	paycheck_status varchar2(1),
    account_number varchar2(20),
    employee_id int  REFERENCES employees(employee_id)
);

insert into employees (employee_id, employee_ssn, employee_first_name, employee_last_name, employee_address, city, state, zip) 
values (1,'123456789', 'MARTINEZ','RODRIGUEZ', '110 WEATHERSFIELD DR','chester','va','21111');

insert into employees (employee_id, employee_ssn, employee_first_name, employee_last_name, employee_address, city, state, zip) 
values (2,'223466781', 'THOMAS','SMITH', '124 NEW CASTLE DR','chester','va','21111');

insert into employees (employee_id, employee_ssn, employee_first_name, employee_last_name, employee_address, city, state, zip) 
values (3,'323476782', 'WHITE','LOPEZ', '364 LEIGH FARM RD','chester','va','21111');

insert into employees (employee_id, employee_ssn, employee_first_name, employee_last_name, employee_address, city, state, zip) 
values (4,'423486783', 'HARRIS','WILLIAMS', '413 NOTTINGHAM DR','chester','va','21111');

insert into employees (employee_id, employee_ssn, employee_first_name, employee_last_name, employee_address, city, state, zip) 
values (5,'523496784', 'jason','LEWIS', '5006 MILL HILL LN','chester','va','21111');



insert into payroll (payroll_id, employee_id, paycheck_status, account_number) 
values (6, 1, 'S','00001234');
insert into payroll (payroll_id, employee_id, paycheck_status, account_number) 
values (7, 2, 'S','00001234');
insert into payroll (payroll_id, employee_id, paycheck_status, account_number) 
values (8, 3, 'S','00001234');
insert into payroll (payroll_id, employee_id, paycheck_status, account_number) 
values (9, 4, 'S','00001234');
insert into payroll (payroll_id, employee_id, paycheck_status, account_number) 
values (10, 5, 'S','00001234');

Last updated