165k views
1 vote
Create a view named NHTrips. It consists of the trip ID, trip name, start location, distance, maximum group size, type, and season for every trip located in New Hampshire (NH). Display the data in the view.

1 Answer

6 votes

Answer:

CREATE VIEW NHTrips AS

SELECT TripID,

TripName,

StartLocation,

Distance,

MaxGrpSize,

Type,

Season

FROM trip

WHERE State = 'NH';

Step-by-step explanation:

A view is a user’s view or application program’s view of the database created for execution during a database operation such as those for displaying results, modification of record, updating and deletion of records. It is created by defining a SELECT query and then using a CREATE VIEW command.

syntax for creating view;

The view is created as follows,

Give a view name using the CREATE VIEW command and give optional field names followed by the query using the SELECT statement

I.e

CREATE VIEW viewname

[(column name1, column name2….)] AS Select statement

When the above query is executed, a view named NHTrips will created in the database.

User Czaporka
by
7.1k points