11 lines
259 B
MySQL
11 lines
259 B
MySQL
|
UPDATE vn.province p
|
||
|
LEFT JOIN vn.zoneGeo zg ON zg.id = p.geoFk
|
||
|
SET p.geoFk = NULL
|
||
|
WHERE zg.id IS NULL;
|
||
|
|
||
|
ALTER TABLE vn.province
|
||
|
ADD CONSTRAINT province_zoneGeo_FK FOREIGN KEY (geoFk)
|
||
|
REFERENCES vn.zoneGeo(id)
|
||
|
ON DELETE RESTRICT
|
||
|
ON UPDATE CASCADE;
|