A view is really nothing more than a logical representation of one or more tables in a database.View offer the following benefits and functionality.
Students c ON c.student_id = b.student_id_fk GO Above is a simple view that provides us with a listing of occupied/unoccupied seats for our classes.As you can see from the examples below, we can use this view in a variety of different ways.Or is this more a case of senior developers/DBAs' telling junior personnel not to do this because they can unwittingly wreak havoc with an incorrect join.EDIT I'm using MSSQL 2000-2008 (Depending on the particulars of the client) triggers "SQL Server must be able to unambiguously trace modifications from the view definition to one base table.".IF ( OBJECT_ID('dbo.vw_students1') IS NOT NULL ) DROP VIEW dbo.vw_students1 GO CREATE VIEW dbo.vw_students1 AS SELECT lastname , firstname , (firstname ' ' lastname) as "Fullname_fl", (lastname ', ' firstname) as "Fullname_lf", birth_dttm, DATEDIFF(yy, birth_dttm, GETDATE()) - CASE WHEN MONTH(birth_dttm) .
The name should be somewhat reflective of the purpose of the view. As you can see in our view we are formatting the first and last name.
Visit Stack Exchange Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Sign up to join this community During College it was banged into our heads to not update tables through views, and again when I got into the workplace we where told do not update the database through views.
Where there/Are there significant performance implications to doing this?
You can also add additional row restriction to the view as we have done.
IF ( OBJECT_ID('dbo.vw_occupied_seats_by_class') IS NOT NULL ) DROP VIEW dbo.vw_occupied_seats_by_class GO CREATE VIEW dbo.vw_occupied_seats_by_class AS SELECT a.course_designater_fk , b.seat_num , (c.firstname ' ' c.lastname) as "Student" FROM dbo. Class Registration b ON a.classes_num = b.classes_num JOIN dbo.
A view is nothing more than a SQL statement that is stored in the database with an associated name.