在MySQL中添加多列检查约束

时间:2019-08-30 03:04:11

标签: mysql

在MySQL(版本为5.7.27-log)中,我有三列left_money,usage_money和Frozen_money。

列类型为整数。是否可以添加约束source_img_simple = cv2.imread('image_name.tif') source_img_simple_gray = cv2.cvtColor(source_img_simple, cv2.COLOR_BGR2GRAY) img_text = pytesseract.image_to_string(source_img_simple_gray) # Export the text file with open('Output_OCR.txt', 'w') as text: text.write(img_text)

1 个答案:

答案 0 :(得分:2)

不要存储从同一表中的其他列计算得出的值。而是使用generated column

ALTER TABLE yourtable
ADD c INT AS (a + b)

Demo on dbfiddle