Question

In: Computer Science

Create a view named ReservationCustomer_VW. It consists of the reservation ID, trip ID, trip name, trip...

Create a view named ReservationCustomer_VW. It consists of the reservation ID, trip ID, trip name, trip date, customer number, customer last name, customer first name, and phone number for trips whose guide is Glory Unser or Susan Kiley. Show the SQL Server code for this view.

Solutions

Expert Solution

Assuming Trip table has all the data then SQL query to create view would be as below:

Create View ReservationCustomer_VW as

Select reservationID, tripId, tripname, tripdate, customernumber, customerlastname, customerfirstname, phonenumber from trips

where guide in ('Glory Unser','Susan Kiley');

e.g. Data in Trip table

Run the command:

Verify that view is created as below:

If your customer table is separated from trip and customer table contains the trip Id from the Trip table your query to create view would be as follow:

Create View ReservationCustomer_VW as

Select a.reservationID, a.tripId, a.tripname, a.tripdate,

b.customernumber, b.customerlastname, b.customerfirstname, b.phonenumbers from trips a

join [dbo].[TripCustomers] b on a.tripid = b.tripid

where guide in ('Glory Unser','Susan Kiley');

Trip table in this scenario:

Trip customer table named as TripCustomer:

Run the create view command:

Below is the data from newly created view

SELECT * FROM ReservationCustomer_VW

Please rate your answer Thanks.


Related Solutions

Oracle - Create a procedure that accepts product ID as a parameter and returns the name...
Oracle - Create a procedure that accepts product ID as a parameter and returns the name of the product from ProductTable table. Add exception handling to catch if product ID is not in the table. Table to use: CREATE TABLE ProductTable(     ProductID INTEGER NOT NULL primary key,     ProductName VARCHAR(50) NOT NULL,     ListPrice NUMBER(10,2),     Category INTEGER NOT NULL ); / INSERT INTO ProductTable VALUES(299,'Chest',99.99,10); INSERT INTO ProductTable VALUES(300,'Wave Cruiser',49.99,11); INSERT INTO ProductTable VALUES(301,'Megaland Play Tent',59.99,11); INSERT INTO...
Create a class named Salesperson. Data fields for Salesperson include an integer ID number and a...
Create a class named Salesperson. Data fields for Salesperson include an integer ID number and a doubleannual sales amount. Methods include a constructor that requires values for both data fields, as well as get and set methods for each of the data fields. Write an application named DemoSalesperson that declares an array of 10 Salesperson objects. Set each ID number to 9999 and each sales value to zero. Display the 10 Salesperson objects. public class DemoSalesperson { public static void...
Question 1 - Create a class named Student that has fields for an ID number, number...
Question 1 - Create a class named Student that has fields for an ID number, number of credit hours earned, and number of points earned. (For example, many schools compute grade point averages based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.) Include methods to assign values to all fields. A Student also has a field for grade point average. Include a method to compute the grade point...
Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth...
Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth Create a table ‘ClassInfo’ table: ID Class Name Class Description Create a table ‘RegisteredClasses’ table: StudentID ClassID The RegisteredClasses table should have a foreign key relationship to StudentInfo and ClassInfo tables for the respective IDs. Also the IDs in StudentInfo and ClassInfo need to be primary keys. When you submit the file your email should also contain the following SQL Queries: Query to show...
Create a view named customer_addresses that shows the shipping and billing addresses for each customer. This...
Create a view named customer_addresses that shows the shipping and billing addresses for each customer. This view should return these columns from the Customers table: customer_id, email_address, last_name and first_name. This view should return these columns from the Addresses table: bill_line1, bill_line2, bill_city, bill_state, bill_zip, ship_line1, ship_line2, ship_city, ship_state, and ship_zip. I have this CREATE VIEW customer_addresses AS SELECT customer_id, email_address, last_name, first_name, bill_line1, bill_line2, bill_city, bill_state, bill_zip, ship_line1, ship_line2, ship_city, ship_state, ship_zip FROM Customers, Addresses WHERE Customers.customer_id = Addresses.customer_id...
Create a class named Student. Student has fields for an ID number, number of credit hours...
Create a class named Student. Student has fields for an ID number, number of credit hours earned, and number of points earned. (For example, many schools compute grade point averages based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.) Include methods to assign values to all fields. Student also has a field for grade point average. Include a method to compute the grade point average field by dividing...
(SQL Coding) Create a view based on the Job History table. Name the view: view_job_history. Select...
(SQL Coding) 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.
JAVA PROGRAMMING Part 1 Create a class Student, with attributes id, first name, last name. (All...
JAVA PROGRAMMING Part 1 Create a class Student, with attributes id, first name, last name. (All the attributes must be String) Create a constructor that accepts first name and last name to create a student object. Create appropriate getters and setters Create another class StudentOperationClient, that contains a main program. This is the place where the student objects are created and other activities are performed. In the main program, create student objects, with the following first and last names. Chris...
Product(p-id, p-name, weight) Retailer(r-id, r-name, city) Sells(r-id, p-id, price)
  Product(p-id, p-name, weight)Retailer(r-id, r-name, city)Sells(r-id, p-id, price) r-id is a foreign key referencing Retailerp-id is a foreign key referencing Product Give a Relational Algebra expression : (IT IS NOT SQL) (a) Find the names of the retailers who are selling the products that have a weight greater than 10 kg.(b) Find the names of the retailers who have never sold a product that has a weight greater than 10 kg.(c) Get the price of the products that have a...
THIS IS JAVA PROGRAMMING 1. Create a class named Name that contains the following: • A...
THIS IS JAVA PROGRAMMING 1. Create a class named Name that contains the following: • A private String to represent the first name. • A private String to represent the last name. • A public constructor that accepts two values and assigns them to the above properties. • Public methods named getProperty (e.g. getFirstName) to return the value of the property. • Public methods named setProperty ( e.g. setFirstName)to assign values to each property by using a single argument passed...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT