【发布时间】:2018-11-11 19:28:51
【问题描述】:
我是 DynamoDB 的新手,在我当前的项目中,我正在尝试将大多数关系表迁移到 Dynamo DB。我正面临一个棘手的场景,我不知道如何解决
在 Posgresql 中,2 个表:
Student
id | name | age | address | phone
---+--------+-----+---------+--------
1 | Alex | 18 | aaaaaa | 88888
2 | Tome | 19 | bbbbbb | 99999
3 | Mary | 18 | ccccc | 00000
4 | Peter | 20 | dddddd | 00000
Registration
id | class | student | year
---+--------+---------+---------
1 | A1 | 1 | 2018
2 | A1 | 3 | 2018
3 | A1 | 4 | 2017
4 | B1 | 2 | 2018
我的查询:
select s.id, s.name, s.age, s.address, s.phone
from Registration r inner join Student s on r.student = s.id
where r.class = 'A1' and r.year = '2018'
结果:
id | name | age | address | phone
---+--------+-----+---------+--------
1 | Alex | 18 | aaaaaa | 88888
3 | Mary | 18 | ccccc | 00000
那么,我该如何设计 dynamoDB 表来实现这个结果呢?扩展为 CRUD
感谢任何建议
【问题讨论】:
标签: postgresql amazon-web-services nosql amazon-dynamodb