Create a view named MAINE_TRIPS. It consists of the trip ID, trip name, start location, distance, maximum group size, type, and season for every trip located in Maine (ME). Write and execute the CREATE VIEW command to create the MAINE_TRIPS view. Write and execute the command to retrieve the trip ID, trip name, and distance for every Biking trip. Write and execute the query that the DBMS actually executes. Does updating the database through this view create any problems

Respuesta :

Answer:

CREATE VIEW [MAINE_TRIPS] AS

SELECT trips_id, trip_name, start_location, distance, maximum_group_size , type, season

FROM trip

WHERE STATE = 'ME';

- To update a view, use the CREATE OR REPLACE VIEW clause. This would update the view with no errors.

Explanation:

The SQL statement above creates a view called MAINE_TRIPS from the trip table. A view is a virtual table that hold the result of query from an actual table.

It accepts all clauses like a normal table. For example, to get the trip id, name and distance column and the rows with the trip type biking;

SELECT trip_id, trip_name, distance FROM [MAINE_TRIPS]

WHERE type = 'biking'