SQLite JSON()

In SQLite, the json() function converts raw text that looks like JSON into actual JSON.

We pass a JSON string as an argument when we call the function. The json() function then checks that the argument is a valid JSON string and returns a minified version of that JSON string. If the argument is not a well-formed JSON string, then an error is thrown.

However, the json() function was not designed to test whether or not a value is valid JSON. To do that, use the json_valid() function instead.

Continue reading

Fix “ERROR 1136 (21S01): Column count doesn’t match value count at row 2” when using the VALUES Statement in MySQL

If you’re getting an error that reads something like “ERROR 1136 (21S01): Column count doesn’t match value count at row 2” when using the VALUES statement in MySQL, it’s probably because there’s a mismatch in the number of columns specified in the ROW() clauses.

To fix this error, be sure that all ROW() clauses contain exactly the same number of columns.

Continue reading