Oracle命名规则
一、标准命名规则
标准命名规则要满足如下要求:
1.以字符开头
2.30个字符以内
3.只能包含A-Z,a-z,0-9,_,$,#
4.不能和同一个用户下的其他对象重名
5.不能是oracle服务器的保留关键字
二、非标准命名规则
还有一类是非标准命名,可以使用任何字符,包括中文,oracle中的保留字,空格等等都是可以的, 但是需要将对象名用双引号引起来。
例如: create table “table” (test1 varchar2(10));将会建立一个表名为table的表。
并没有什么语法错误。但这这样以后就需要以后在使用这个对象时必须用双引号经对象引起来。
非标准命名在后续使用中容易因为忽略双引号导致种种错误,如非必要,个人不建议使用。
PostgreSQL命名规则
一、标准命名规则
标准命名规则要满足如下要求:
1.SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_).
2.Subsequent characters in an identifier or key word can be letters(a-z), underscores(_), digits (0-9), or dollar signs ($).
Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable.
3.不能和同一个模式下的其他对象重名
4.不能是PostgreSQL关键字(注意不同对象的关键字不同)
5.The SQL standard will not define a key word that contains digits or starts or ends with an underscore, so identifiers of this form are safe against possible conflict with future extensions of the standard.
二、非标准命名规则
还有一类是非标准命名,可以使用任何字符,包括中文,PostgreSQL中的保留字,空格等等都是可以的。 但是需要将对象名用双引号引起来。并没有什么语法错误。但这这样以后就需要以后在使用这个对象时必须用双引号经对象引起来。