7.2

Benefits of Using Views

Benefits of Using Views

Code Sample:

USE WORLD;
CREATE VIEW city_country AS
SELECT ci.name AS city_name, co.name AS country_name
FROM city ci
    JOIN country co
    ON ci.CountryCode = co.Code;

Results by selecting from the city_country view:

v_01.png

CREATE VIEW city_country AS


SELECT ci.name AS city_name, co.name AS country_name

FROM city ci

     JOIN country co

    ON ci.CountryCode = co.Code;