Home>Topic List> How to write mysql check constraints

How to write mysql check constraints

MySQL method for writing check constraints: 1. Use the ENUM data type. The ENUM data type allows us to define a fixed list of values when creating a table, and then limit the value of the column to a value in the list. For example, you can create a named is the gender column, and defines it as ENUM('male', 'female'), so that the value of this column can only be 'male' or 'female'; 2. Use a trigger. The trigger is a specific A database object that executes automatically when an event occurs. Triggers can be used to implement more complex check constraints.

Related courses More>
Advanced Database mysql video tutorial

28886 times of learning

Collection
Advanced Shangxuetang MySQL video tutorial

16738 times of learning

Collection
Elementary MySQL latest manual tutorial

125389 times of learning

Collection
Related Tutorials More>
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!