SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
-- INIT database CREATE TABLE Product ( ProductID INT AUTO_INCREMENT KEY, Name VARCHAR(100), params VARCHAR(255) ); INSERT INTO Product(Name, params) VALUES ( 'Entity Framework Extensions', '{"fields_fee_amount":[],"plox":{"company":{"id":286}}}'); -- QUERY database SELECT "1" as query, Name,JSON_EXTRACT(r.params, "$.plox.company.id") FROM Product r; SELECT "2" as query, Name FROM Product r WHERE JSON_SEARCH(r.params, 'one', '286', null, "$.plox.company.id"); SELECT "3" as query, Name FROM Product r WHERE r.params->"$.plox.company.id" = 286; SELECT "4" as query, Name FROM Product r WHERE JSON_CONTAINS(r.params, 286, "$.plox.company.id"); SELECT "5" as query, Name FROM Product r WHERE JSON_EXTRACT(r.params, "$.plox.company.id") = 286;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear