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 `tbl_hospital` ( `id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `services` JSON NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; INSERT INTO `tbl_hospital` (`name`, `services`) VALUES ('Hospital Alpha', '["10","12","20"]'), ('Hospital Beta', '["10","20"]'), ('Hospital Gamma', '["12","30"]'), ('Hospital Delta', '["10","12"]'), ('Hospital Epsilon', '[]'); SELECT `id`, `name`, `services` FROM `tbl_hospital` WHERE JSON_CONTAINS(`services`, '"10"', '$') AND JSON_CONTAINS(`services`, '"12"', '$');

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

Copy Clear