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 `orders` ( `id` int(11) NOT NULL AUTO_INCREMENT, `order_date` datetime NOT NULL, `order_month` VARCHAR(6) AS (CONCAT(MONTH(order_date), YEAR(order_date))) PERSISTENT, `client_id` int(11) NOT NULL, PRIMARY KEY (`id`), INDEX (`order_month`) ); INSERT INTO `orders` (`order_date`, `client_id`) VALUES (NOW(), 123); SELECT * FROM `orders` WHERE `order_month` = '22021'; EXPLAIN SELECT * FROM `orders` WHERE `order_month` = '22021';

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

Copy Clear