Professional Documents
Culture Documents
email address of the staff from all the company stores. The output needs to be
in alphabetical order based on the last name then by the first name. The
skeleton of the stored procedure is provided below.
USE BikeStores;
GO
CREATE PROCEDURE GetCompanyStaffList
AS
EXECUTE GetCompanyStaffList;
Problem 2: Create a stored procedure that lists the customers from a
specified zip code.
USE BikeStores;
GO
CREATE PROCEDURE GetCustomersByZipCode
@ZipCode nvarchar(50)
AS
GO
-- Query the view
SELECT first_name, last_name, email
FROM CompanyStaffListView
Problem 7: Establish a database view called BuffaloCustomersView that
lists the last name, first name, and email address of customers that live in the
city of Buffalo, NY. Then execute a SELECT query to verify the view.
USE BikeStores;
GO
CREATE VIEW BuffaloCustomersView
AS
SELECT [last_name]
,[first_name]
,[email]
FROM [sales].[customers] AS C
WHERE C.city LIKE '%Buffalo%' AND C.[state] = 'NY'
GO