表之间的关系?
我看过很多数据库的ER图和概念模式,但我仍然不太清楚如何从中创建表并查询它们?
例如,下面是一个模式数据库,如何从中创建表并查询它?
假设我需要执行查询来查找类型“动作”中包含关键字“美国”的所有电影”(类型 ID = 126)。有什么想法吗?
I have seen ER diagrams and conceptual schema of many databases, but I am still not very clear how do you create table out of it and query them?
For example, below is a schema database and how do create tables out of it and query it?
Say I need perform a query to find all films that include the keyword “America” within the genre “Action” (genre ID = 126). any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
大多数可以创建 ER 图的工具还可以生成实现数据库所需的 SQL 语句。否则,您必须手动完成此操作,方法是阅读图表并将其自行翻译成 SQL。
因此,查看 ER 图,您可能会写
This image does not show data types (like VARCHAR(35)) 和约束(如 Year > 1900),所以我只是猜测。
现在您只需将数据插入表中,就可以开始了。
Most tools that can create an ER diagram can also generate the SQL statements necessary to implement the database. Otherwise, you have to do it manually, by reading the diagram and translating it yourself into SQL.
So, looking at the ER diagram, you might write
This image doesn't show data types (like VARCHAR(35)) and constraints (like Year > 1900), so I just guessed.
Now you just have to insert data into the tables, and you're good to go.