Column constraint: allow growing only value

sharpener

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.

Gordon Linoff

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] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Javascript allow only text value

분류에서Dev

Unique constraint on multiple columns - allow for single null

분류에서Dev

Only allow hexadecimal regex

분류에서Dev

Find and Replace specific column, but only when it equals a specific value

분류에서Dev

How to allow to only one dot?

분류에서Dev

sqlite3 - Column constraint not working

분류에서Dev

How to disable (make read only) a cell in a DataGridView CheckBox column based on the value in other cells?

분류에서Dev

Fetching data from SQLite and want to get only the last value of column id

분류에서Dev

Allow outgoing connections only to specific domain/IP

분류에서Dev

CorePlot : Allow horizontal scrolling in positive quadrant only

분류에서Dev

Only Allow 1 RSVP in Parties Example

분류에서Dev

Only Allow 1 RSVP in Parties Example

분류에서Dev

htaccess prevent access to .php and allow only with RewriteRule

분류에서Dev

Only allow plain text in aspx textbook

분류에서Dev

How to allow only one checkbox checked at a time?

분류에서Dev

Regex to allow only numbers and +, -, () for number phone

분류에서Dev

Allow shell script to modify only containing directory

분류에서Dev

Allow file read only through application

분류에서Dev

Rails: How to only allow User to apply to job only once?

분류에서Dev

Enforcing a unique constraint on a column encrypted with cell level encryption

분류에서Dev

How to add default constraint on an existing column in SQL Server

분류에서Dev

Birt report Parameter allow multiple value

분류에서Dev

Symfony validation to validate a simple value does not work with LessThan constraint

분류에서Dev

Make only one column editable

분류에서Dev

mysql SELECT column only if exists

분류에서Dev

Incorrect integer value: '' for column

분류에서Dev

Value in each column of table

분류에서Dev

jQuery mobile - allow scrolling only when side panel is closed?

분류에서Dev

Allow only numbers and multiple dots in jquery form input

Related 관련 기사

  1. 1

    Javascript allow only text value

  2. 2

    Unique constraint on multiple columns - allow for single null

  3. 3

    Only allow hexadecimal regex

  4. 4

    Find and Replace specific column, but only when it equals a specific value

  5. 5

    How to allow to only one dot?

  6. 6

    sqlite3 - Column constraint not working

  7. 7

    How to disable (make read only) a cell in a DataGridView CheckBox column based on the value in other cells?

  8. 8

    Fetching data from SQLite and want to get only the last value of column id

  9. 9

    Allow outgoing connections only to specific domain/IP

  10. 10

    CorePlot : Allow horizontal scrolling in positive quadrant only

  11. 11

    Only Allow 1 RSVP in Parties Example

  12. 12

    Only Allow 1 RSVP in Parties Example

  13. 13

    htaccess prevent access to .php and allow only with RewriteRule

  14. 14

    Only allow plain text in aspx textbook

  15. 15

    How to allow only one checkbox checked at a time?

  16. 16

    Regex to allow only numbers and +, -, () for number phone

  17. 17

    Allow shell script to modify only containing directory

  18. 18

    Allow file read only through application

  19. 19

    Rails: How to only allow User to apply to job only once?

  20. 20

    Enforcing a unique constraint on a column encrypted with cell level encryption

  21. 21

    How to add default constraint on an existing column in SQL Server

  22. 22

    Birt report Parameter allow multiple value

  23. 23

    Symfony validation to validate a simple value does not work with LessThan constraint

  24. 24

    Make only one column editable

  25. 25

    mysql SELECT column only if exists

  26. 26

    Incorrect integer value: '' for column

  27. 27

    Value in each column of table

  28. 28

    jQuery mobile - allow scrolling only when side panel is closed?

  29. 29

    Allow only numbers and multiple dots in jquery form input

뜨겁다태그

보관