Create a view named myView_757 (last 3 digits of your student number) That view should display employee_id, first_name,last_name & department ID from the Employees table Create the view Show that the view is created Run the view and show the result CREATE TABLE employees ( employee_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, first_name VARCHAR2 (20) DEFAULT NULL, last_name VARCHAR2 (25) NOT NULL, email VARCHAR2 (100) NOT NULL, phone_number VARCHAR2 (20) DEFAULT NULL, hire_date DATE NOT NULL, job_id NUMBER NOT NULL, salary NUMBER (8, 2) NOT NULL, manager_id NUMBER DEFAULT NULL, department_id NUMBER DEFAULT NULL ) INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (100,'Steven','King','steven.king@sqltutorial.org','515.123.4567',DATE '1987-06-17',4,24000.00,NULL,9); INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (101,'Neena','Kochhar','neena.kochhar@sqltutorial.org','515.123.4568',DATE '1989-09-21',5,17000.00,100,9); CREATE TABLE employees ( employee_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, first_name VARCHAR2 (20) DEFAULT NULL, last_name VARCHAR2 (25) NOT NULL, email VARCHAR2 (100) NOT NULL, phone_number VARCHAR2 (20) DEFAULT NULL, hire_date DATE NOT NULL, job_id NUMBER NOT NULL, salary NUMBER (8, 2) NOT NULL, manager_id NUMBER DEFAULT NULL, department_id NUMBER DEFAULT NULL ) INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (100,'Steven','King','steven.king@sqltutorial.org','515.123.4567',DATE '1987-06-17',4,24000.00,NULL,9); INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (101,'Neena','Kochhar','neena.kochhar@sqltutorial.org','515.123.4568',DATE '1989-09-21',5,17000.00,100,9); INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (102,'Lex','De Haan','lex.de haan@sqltutorial.org','515.123.4569',DATE '1993-01-13',5,17000.00,100,9); INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (103,'Alexander','Hunold','alexander.hunold@sqltutorial.org','590.423.4567',DATE '1990-01-03',9,9000.00,102,6); INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (104,'Bruce','Ernst','bruce.ernst@sqltutorial.org','590.423.4568',DATE '1991-05-21',9,6000.00,103,6); INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (105,'David','Austin','david.austin@sqltutorial.org','590.423.4569',DATE '1997-06-25',9,4800.00,103,6);
Create a view named myView_757 (last 3 digits of your student number)
That view should display employee_id, first_name,last_name & department ID from the Employees table
- Create the view
- Show that the view is created
- Run the view and show the result
CREATE TABLE employees (
employee_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
first_name VARCHAR2 (20) DEFAULT NULL,
last_name VARCHAR2 (25) NOT NULL,
email VARCHAR2 (100) NOT NULL,
phone_number VARCHAR2 (20) DEFAULT NULL,
hire_date DATE NOT NULL,
job_id NUMBER NOT NULL,
salary NUMBER (8, 2) NOT NULL,
manager_id NUMBER DEFAULT NULL,
department_id NUMBER DEFAULT NULL
)
INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (100,'Steven','King','steven.king@sqltutorial.org','515.123.4567',DATE '1987-06-17',4,24000.00,NULL,9);
INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (101,'Neena','Kochhar','neena.kochhar@sqltutorial.org','515.123.4568',DATE '1989-09-21',5,17000.00,100,9);
CREATE TABLE employees (
employee_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
first_name VARCHAR2 (20) DEFAULT NULL,
last_name VARCHAR2 (25) NOT NULL,
email VARCHAR2 (100) NOT NULL,
phone_number VARCHAR2 (20) DEFAULT NULL,
hire_date DATE NOT NULL,
job_id NUMBER NOT NULL,
salary NUMBER (8, 2) NOT NULL,
manager_id NUMBER DEFAULT NULL,
department_id NUMBER DEFAULT NULL
)
INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (100,'Steven','King','steven.king@sqltutorial.org','515.123.4567',DATE '1987-06-17',4,24000.00,NULL,9);
INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (101,'Neena','Kochhar','neena.kochhar@sqltutorial.org','515.123.4568',DATE '1989-09-21',5,17000.00,100,9);
INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (102,'Lex','De Haan','lex.de haan@sqltutorial.org','515.123.4569',DATE '1993-01-13',5,17000.00,100,9);
INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (103,'Alexander','Hunold','alexander.hunold@sqltutorial.org','590.423.4567',DATE '1990-01-03',9,9000.00,102,6);
INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (104,'Bruce','Ernst','bruce.ernst@sqltutorial.org','590.423.4568',DATE '1991-05-21',9,6000.00,103,6);
INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (105,'David','Austin','david.austin@sqltutorial.org','590.423.4569',DATE '1997-06-25',9,4800.00,103,6);
Step by step
Solved in 2 steps