Often when I define a View in Navicat I receive the following message:
xxx does not have a primary key. Updates to this table will be done using the following pseudo statement: UPDATE xxx SET ModifiedFieldsAndValues WHERE AllFieldsAndOldValues LIMIT 1
Obviously I only use my Views for viewing data, not updating. But this did make me curious:
Is there a way to define a "primary key" or "unique index" on a View?
its implied that the view uses the indices and primary keys of its base table. You can change the semantics of how insert and updates occur when using them via views by playing with the CASCADING CHECK options
来源:https://stackoverflow.com/questions/884167/mysql-views-in-navicat-how-to-define-primary-key