name
The name (optionally schema-qualifIEd) of an existing table to alter. If ONLY is specifIEd before the table name,only that table is altered. If ONLY is not specifIEd,the table and all its descendant tables (if any) are altered. Optionally,* can be specifIEd after the table name to explicitly indicate that descendant tables are included.
什么是后代表?
解决方法Postgresql implements table inheritance,which can be a useful tool
for database designers. (sql:1999 and later define a type inheritance
feature,which differs in many respects from the features described
here.)Let’s start with an example: suppose we are trying to build a data
model for citIEs. Each state has many citIEs,but only one cAPItal. We
want to be able to quickly retrIEve the cAPItal city for any
particular state. This can be done by creating two tables,one for
state cAPItals and one for citIEs that are not cAPItals. However,what
happens when we want to ask for data about a city,regardless of
whether it is a cAPItal or not? The inheritance feature can help to
resolve this problem. We define the cAPItals table so that it inherits
from citIEs:
CREATE table citIEs ( name text,population float,altitude int -- in feet);CREATE table cAPItals ( state char(2)) inheritS (citIEs);@H_502_43@In this case,the cAPItals table inherits all the columns of its
parent table,citIEs. State cAPItals also have an extra column,state,
that shows their state.In Postgresql,a table can inherit from zero or more other tables,and
a query can reference either all rows of a table or all rows of a
table plus all of its descendant tables. The latter behavior is the
default.资料来源:https://www.postgresql.org/docs/8.4/static/ddl-inherit.html
总结以上是内存溢出为你收集整理的Postgresql中的“后代表”是什么?全部内容,希望文章能够帮你解决Postgresql中的“后代表”是什么?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)