开发者

Can a table and a column within it use the same name in Sybase?

I am using a Sybase database and would like to know if it's valid to have a table contain a column with the same name as that of the table, e.g.:

CREATE TABLE foo
(
     foo      int      not null开发者_如何学编程,
     etc...
)


Valid? Sure. Recommended? No.


Yes, we can surely do that but as said it is not recommended. But why are we able to do so? Well, because a table name entry goes into the system table sysobjects however column entries go in the system table syscolumns.

Therefore there is no restriction in using table name as column name, however using table name as column name usually is not recommended because it makes your table structure a bit confusing and also it adds bad practice to database design.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜