You administrate data for two local college campuses. Data is kept in the MSTUDENTS and VSTUDENTS tables. Only the information for the current year is kept in the database; the information for the previous years has been archived and removed from the database. You want to create a procedure that would produce a report about the enrollment for both campuses for a given month. The report should present all of the columns in the MSTUDENTS and VSTUDENTS tables. The first column in the should be entitled Campus. The Campus column should include a value of Moorpark for the MSTUDENTS tables and a value of Venture for the VSTUDENTS table. Which of the following procedures should you use?

You administrate data for two local college campuses. Data is kept in  the MSTUDENTS and VSTUDENTS tables. Only the information for the current year is kept in the database; the information for the previous years has been archived and removed from the database. You want to create a procedure that would produce a report about the enrollment for both campuses for a given month. The report should present all of the columns in the MSTUDENTS and VSTUDENTS tables. The first column in the should be entitled Campus. The Campus column should include a value of Moorpark for the MSTUDENTS tables and a value of Venture for the VSTUDENTS table. Which of the following procedures should you use?


Answer: – CREATE PROCEDURE Report @m int AS SELECT Campus, * FROM VSTUDENTS WHERE DATEPART (mm, Date) - @m UNION ALL select Campus, * FROM VSTUENTS WHERE DATEPART (mm, date) = @m

(The number of columns and data type of each column in each result set before and after the UNION must match.)