May 2020
Beginner
564 pages
14h 9m
English
To insert data into a view that has WITH CHECK OPTION, you can execute the following query:
USE lahmansbaseballdb;INSERT INTO parksaliasVALUES (NULL, 'TST01', 'testing park name', 'Seattle', 'WA', 'US');
The preceding query will return the following error:
Error Code: 1423. Field of view 'lahmansbaseballdb.parksalias' underlying table doesn't have a default value.
The preceding error has to do with the fact that the ID field in the parks_copy table isn't auto-incremented, and your view doesn't include it. This brings up an interesting point about inserting data via a view because this could happen to you if an ID field isn't auto incremented or another field doesn't allow a NULL to be inserted. If those ...
Read now
Unlock full access