I would like to restrict values in mySql table column to satisfy the rule the new values inserted must be greater than any existing ones. As I cannot find any other than UNIQUE
and AUTOINCREMENT
constraints, I would like to ask, if there is any possibility to reach such functionality in mySql.
You would have to implement such functionality using a before insert
trigger.
MySQL supports the syntax of check constraints, but it doesn't actually implement the logic. That leaves trigger.
Also, there might be additional options if you edit your question and explain what the column is representing. For an id
type of column, for instance, you can use autoincrement
. If it is a cumulative sum of some sort, then perhaps storing the changes would make more sense than storing the total.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다