请按照下文要求利用MySQL写出代码:The Database Developer at GlobalToyzcreated the following viewCREATE VIEW view_country_shopper ASSELECT cShopperldvFirstNamevLastNamecCountryFROM country AS cshopper AS sWHERE ccCou
The error in the statement is the use of single quotes around the country code, which should be double quotes instead. Also, since the view is a combination of two tables, we cannot directly update it. Instead, we need to update the underlying tables and the view will reflect the changes.
The corrected statement is:
UPDATE country c, shopper s SET s.vFirstName='Smith', c.cCountry='US' WHERE c.cCountryld=s.cCountryld AND c.cCountryld="001";
This will update the first name and country for all shoppers in country 001. The view_country_shopper will automatically reflect these changes
原文地址: https://www.cveoy.top/t/topic/fzt7 著作权归作者所有。请勿转载和采集!