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.

MySQL Update Error: Correcting View Updates for Shopper and Country Data

原文地址: https://www.cveoy.top/t/topic/ojgE 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录