check user following or not functionality mysql code example
Example 1: mysql find db contarint
select *
from information_schema.key_column_usage
where constraint_name='[CONSTRAINT_NAME]'
Example 2: ERROR 3814 (HY000): An expression of a check constraint 'INV_CK1' contains disallowed function: `TO_DATE`.
mysql> CREATE TABLE t1 (c1 INTEGER CHECK (c1 > 0));
Query OK, 0 rows affected (0.04 sec)
mysql> SHOW CREATE TABLE t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.01 sec)
-- CHECK constraint search condition is not evaluated.
mysql> INSERT INTO t1 VALUES (0);
Query OK, 1 row affected (0.00 sec)
Example 3: mysql show check constraints
select COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_COLUMN_NAME, REFERENCED_TABLE_NAME
from information_schema.KEY_COLUMN_USAGE
where TABLE_NAME = 'users';