Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE `test1` ( `question_id` bigint(20) unsigned NOT NULL DEFAULT 0, `selected_answer` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `correct_answer` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL ); INSERT INTO `test1` VALUES (304,'[\"2\"]','[\"2\"]'), (305,'[\"4\"]','[\"1\"]'), (306,'[\"4\"]','[\"2\"]'), (307,'[\"3\"]','[\"2\",\"3\"]'), (108,'[\"1\"]','[\"1\"]'), (402,'[[\"1\", \"7\"], [\"2\", \"6\"], [\"4\", \"5\"], [\"3\", \"8\"]]','[[\"2\",\"6\"],[\"3\",\"8\"],[\"4\",\"5\"],[\"1\",\"7\"]]'), (403,'[\"2\"]','[\"2\"]'), (1080,'[\"2\", \"4\"]','[\"2\",\"4\"]'); select question_id, selected_answer, correct_answer, json_array_intersect(selected_answer, correct_answer) from test1; select question_id, selected_answer, correct_answer, json_array_intersect(selected_answer, correct_answer) from test1 where question_id > 306;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear