tsql对于这种类型的数据库模式是什么? [英] What would the tsql be for this type of database schema?

查看:209
本文介绍了tsql对于这种类型的数据库模式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个href =http://stackoverflow.com/questions/5419931/help-designing-a-database-schema-for-a-pizza-store>问这个问题,有人建议这种类型的模式。我不太熟悉超级/亚型的工作原理。你能给我一个TSQL的例子,我将如何创建这个数据库?

I asked this question, and someone suggested this type of schema. I'm not familiar with how super/subtypes work. Can you show me a TSQL example of how I would create this database?

另外一个我遇到麻烦的问题是给我一个命令,一个集合的项目,如何知道一个项目是比萨,饮料还是旁餐?

Another problem I'm having trouble wrapping my head around, is given an order, and a collection of items in that order, how would I know if an item is a Pizza, Beverage or Side dish?

谢谢。

推荐答案

表:


  • ITEM_SUPER_TYPE_ID(pk,IDENTITY)

  • 描述


  • ITEM_SUB_TYPE_ID(pk,IDENTITY)

  • ITEM_SUPER_TYPE_ID(fk to ITEM_SUPER_TYPE.ITEM_SUPER_TYPE_ID)

  • 描述


  • ITEM_ID

  • ITEM_SUB_TYPE_ID(fk to ITEM_SUB_TYPE.ITEM_SUB_TYPE_ID)

类型可以从子类型推断。

This way, the super type can be inferred from the subtype.

这篇关于tsql对于这种类型的数据库模式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆