图书馆数据库的 ER 图和 SQL DDL

发布于 2024-10-05 00:47:01 字数 441 浏览 0 评论 0原文

我正在尝试为一个简单的图书馆数据库绘制 ER 图和 SQL ddl。

我有以下实体:

Book (holds the ISBN as key, book title, author)
Copy (copyID of a copy of a book, dateAcquired, dateDestroyed)
Member (MemberID, name, address)
Loaned (i guess the date due and the date back and obviously foreign keys for memberID and copyID)

成员也可以是学生工作人员。所以我认为这应该是一种“IS-A”关系。

我如何用正确的 ER 图和 SQL-DDL 来表示这一点

I'm trying to draw an ER-diagram and SQL ddl for a simple library database.

I have the following entities:

Book (holds the ISBN as key, book title, author)
Copy (copyID of a copy of a book, dateAcquired, dateDestroyed)
Member (MemberID, name, address)
Loaned (i guess the date due and the date back and obviously foreign keys for memberID and copyID)

Also a Member can be Student or Staff. So i think this should be a "IS-A" relationship.

How can i represent this in a proper ER-Diagram and SQL-DDL

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凤舞天涯 2024-10-12 00:47:01

我使用 SQL Server 2008 Express 为 Northwind 数据库创建了此图表。该图是SSMS绘制的
alt text

  1. 按照以下步骤
  2. 在 SSMS 中展开数据库
  3. 右键单击​​数据库图
  4. 选择新数据库图
  5. 在添加表中选择表对话
    该图将被创建并显示在窗口中。可以在图表窗口中创建新的表、关系、索引等。

对于 SQL-DDL,我使用 SSMS 编写数据库脚本

I used SQL Server 2008 Express to create this diagram for the Northwind db. The diagram was drawn by SSMS
alt text

  1. follow these steps
  2. Expand the database in SSMS
  3. Right click on Database Diagrams
  4. Select New Databse Diagram
  5. Select you tables in the Add Table dialog
    The diagram will be created and displayed in the window. New tables, relationships, index etc may be created within the diagram window.

For the SQL-DDL I script the dataabse using SSMS

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文