JSON Schema Validation Functions ’>  } ’> }’; Query OK, 0 rows affected (0.00 sec) mysql>  SELECT JSON_SCHEMA_VALID(@schema, @document); +---------------------------------------+ | JSON_SCHEMA_VALID(@schema, @document) | +---------------------------------------+ | 1 | +---------------------------------------+ 1 row in set (0.00 sec) mysql>  CREATE TABLE geo ( -> coordinate JSON, -> CHECK( -> JSON_SCHEMA_VALID( -> ’{ ’> "type":"object", ’> "properties":{ ’> "latitude":{"type":"number", "minimum":-90, "maximum":90}, ’> "longitude":{"type":"number", "minimum":-180, "maximum":180} ’> }, ’> "required": ["latitude", "longitude"] ’> }’, -> coordinate -> ) -> ) ->  ); Query OK, 0 rows affected (0.45 sec) mysql>  SET @point1 = ’{"latitude":59, "longitude":18}’; Query OK, 0 rows affected (0.00 sec) mysql>  SET @point2 = ’{"latitude":91, "longitude":0}’; Query OK, 0 rows affected (0.00 sec) mysql>  SET @point3 = ’{"longitude":120}’; Query OK, 0 rows affected (0.00 sec) JSON_SCHEMA_VALID() and CHECK constraints.  JSON_SCHEMA_VALID()  can also be used to enforce  CHECK  constraints. Consider the table  geo  created as shown here, with a JSON column  coordinate  representing a point of latitude and longitude on a map, governed by the JSON schema used as an argument in a JSON_SCHEMA_VALID()  call which is passed as the expression for a  CHECK  constraint on this table: Because a MySQL  CHECK  constraint cannot contain references to variables, you must pass the JSON schema to  JSON_SCHEMA_VALID()  inline when using it to specify such a constraint for a table. We assign JSON values representing coordinates to three variables, as shown here: The first of these values is valid, as can be seen in the following  INSERT  statement: mysql> INSERT INTO geo VALUES(@point1); Query OK, 1 row affected (0.05 sec) The second JSON value is invalid and so fails the constraint, as shown here: mysql> INSERT INTO geo VALUES(@point2); 2383 Note