SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
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 ChatGPT!

Copy Clear