Saturday, November 7, 2009

View Querie

VIEWS

Say we have the following table:


TABLE Customer


(First_Name char(50),
Last_Name char(50),
Address char(50),
City char(50),
Country char(25),
Birth_Date date)


and we want to create a view called V_Customer that contains only the First_Name, Last_Name, and Country columns from this table,


CREATE VIEW V_Customer
AS SELECT First_Name, Last_Name, Country
FROM Customer


Now we have a view called V_Customer with the following structure:


View V_Customer
(First_Name char(50),
Last_Name char(50),
Country char(25))


SELECT * FROM V_Customer

No comments:

Post a Comment