回答編集履歴
1
chousei
answer
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
```SQL
|
2
|
-
create table customers(id int primary key,name varchar(20),
|
2
|
+
create table customers(id int primary key,name varchar(20),addresses json);
|
3
3
|
insert into customers values
|
4
4
|
(1,'名前1','[{"zip": "123-4567","province": "東京"},{"zip": "123-4567","province": "神奈川"}]'),
|
5
5
|
(2,'名前2','[{"zip": "123-4567","province": "青森"},{"zip": "123-4567","province": "北海道"}]'),
|
6
6
|
(3,'名前3','[{"zip": "123-4567","province": "東京"},{"zip": "123-4567","test":"北海道"},{"zip": "123-4567","test":"北海道"}]');
|
7
7
|
|
8
|
-
select * from customers where json_contains(
|
8
|
+
select * from customers where json_contains(addresses->"$[*].province", '"北海道"');
|
9
9
|
```
|