このJSONデータを使用して効率的なmySQL INSERTクエリを作成しようとしています(明確にするためにJSONに変換されています):
[
{
"job": "Avocado Books Binding",
"tasks": [
"Finish collating the signatures",
"Fix perfect binders",
"Fold signatures"
]
},
{
"job": "Prepress Workflow Development",
"tasks": [
"Research new proofing machines",
"Find free proofing software"
]
}
]
結果のテーブル構造は次のようになります (このデータを使用)
Table: Jobs
job_id job_title
1 Avocado Books Binding
2 Prepress Workflow Development
Table: Tasks
task_id task_description job_id
1 Finish collating the signatures 1
2 Fix perfect binders 1
3 Fold signatures 1
4 Research new proofing machines 2
5 Find free proofing software 2
ジョブとタスクが job_id によって関連付けられている場所。
また、効率的な方法でこのデータを取得するための SELECT クエリを作成しようとしています。
ヘルプ、参照、または提案は大歓迎です。
アップデート:
PHP 配列としての構造
Array
(
[0] => Array
(
[job] => Avocado Books Binding
[tasks] => Array
(
[0] => Finish collating the signatures
[1] => Fix perfect binders
[2] => Fold signatures
)
)
[1] => Array
(
[job] => Avocado Books Binding
[tasks] => Array
(
[0] => Finish collating the signatures
[1] => Fix perfect binders
[2] => Fold signatures
)
)
)