Question

In: Computer Science

(SQL Coding) Create a view based on the Job History table. Name the view: view_job_history. Select...

(SQL Coding)

  1. Create a view based on the Job History table.

Name the view: view_job_history. Select all columns to be included in the view.

Add a WHERE clause to restrict the employee_id to be greater than 150. Add the WITH READ ONLY option.

Show me the code used to create the view and the results of a select statement on the view.

Solutions

Expert Solution

Code for Creating View view_job_history and display the results are as follows.

create view view_job_history as select * from job_history where employee_id > 150 with read only;

select * from view_job_history;

Table job_history contains the following data.

EMPLOYEE_ID ENAME JOB       MGR HIREDATE   SAL
----------- ---------- --------- ---------- --------- ----------
7369 SMITH CLERK   7902 17-DEC-80   800
7499 ALLEN SALESMAN 7698 20-FEB-81   1600
7521 WARD SALESMAN 7698 22-FEB-81   1250
7566 JONES MANAGER   7839 02-APR-81   2975
7654 MARTIN SALESMAN 7698 28-SEP-81   1250
7698 BLAKE MANAGER   7839 01-MAY-81   2850
7782 CLARK MANAGER   7839 09-JUN-81   2450
7788 SCOTT ANALYST   7566 09-DEC-82   3000
7839 KING PRESIDENT   17-NOV-81   5000
7844 TURNER SALESMAN 7698 08-SEP-81   1500
7876 ADAMS CLERK   7788 12-JAN-83   1100
7900 JAMES CLERK   7698 03-DEC-81   950
7902 FORD ANALYST   7566 03-DEC-81   3000
7934 MILLER CLERK   7782 23-JAN-82   1300
   100 Prakash Progr   7712 10-JUL-99   10000
   101 Chiranjibi Progr   7717 10-JUL-98   15000

Screen Shots


Related Solutions

IN SQL Create a table called product containing a product no, company name, model_no,product name. What...
IN SQL Create a table called product containing a product no, company name, model_no,product name. What is my primary key? Which datatypes should I use?Pleasesubmit a printout of the commands used for creating the above table and the resultsof your queries/commands
USE SQL CREATE TABLE IF NOT EXISTS football_games ( visitor_name VARCHAR(30),       /* Name of the visiting...
USE SQL CREATE TABLE IF NOT EXISTS football_games ( visitor_name VARCHAR(30),       /* Name of the visiting team                     */ home_score SMALLINT NOT NULL,   /* Final score of the game for the Buffs         */ visitor_score SMALLINT NOT NULL,/* Final score of the game for the visiting team */ game_date DATE NOT NULL,        /* Date of the game                              */ players INT[] NOT NULL,         /* This array consists of the football player ids (basically a foreign key to the football_player.id) */ PRIMARY KEY(visitor_name, game_date)...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table as...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table as if it were being added to MySQL (please give explanations for each line of SQL code and a copy of the code as it would be entered into the query by itself: Customer PK Customer ID Text Phone Number int name text address ID int email text FK vendor ID int Vendor is the name of the table the FK comes from.
Use a single SQL statement to create a relational table and to load into the table...
Use a single SQL statement to create a relational table and to load into the table department name, subject code, year of running and session of running that offered by the departments. Note that a running subject offered by a department means a lecturer of the department has been assigned to teach the subject. Next, enforce the appropriate consistency constraints on the new table.    When ready use SELECT statement to list the contents of the relational table created and...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer PK Customer ID Text Phone Number int name text address ID int email text FK vendor ID int Vendor is the name of the table the FK comes from.
write a sql statement that retrieves product ID (ProductID) and name (Name) from Production.product table for...
write a sql statement that retrieves product ID (ProductID) and name (Name) from Production.product table for all product whose name includes both the words "silver" and "frame"
SUBJECT: PROGRAMMING IN SQL 1. Create a view named vDepartmentInstructors that returns these columns: the DepartmentName...
SUBJECT: PROGRAMMING IN SQL 1. Create a view named vDepartmentInstructors that returns these columns: the DepartmentName column from the Departments table the LastName, FirstName, Status, and AnnualSalary columns from the Instructors table. 2. Write a SELECT statement that returns all the columns from the vDepartmentInstructors view that you created in question 1. Return one row for each fulltime instructor in the English department. 3. Write an UPDATE statement that updates the vDepartmentInstructors view you created in question 1 so it...
Create a table in SQL with foreign key reference: 1.Create the three tables without any columns...
Create a table in SQL with foreign key reference: 1.Create the three tables without any columns 2.Alter the tables to add the columns 3.Alter the tables to create the primary and foreign keys
Using SQL create a new database called school_app. Create a student table with fields id (auto...
Using SQL create a new database called school_app. Create a student table with fields id (auto increment), first_name, last_name. Create a course table with fields id (auto increment), course code (such as ITC or MTH), and course number (such as 100 or 295). Note that the relationship between student and course is many-to-many (n:m). Create a join table called student_course that implements the n:m relationship with fields id (auto increment), student_id, course_id, and grade (which has values 0, 1, 2,...
Create a ‘Student’ table using SQL query. The table must have at least five attributes from...
Create a ‘Student’ table using SQL query. The table must have at least five attributes from your choice with different data types.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT