微軟數(shù)據(jù)庫(kù)命名規(guī)范_第1頁(yè)
微軟數(shù)據(jù)庫(kù)命名規(guī)范_第2頁(yè)
微軟數(shù)據(jù)庫(kù)命名規(guī)范_第3頁(yè)
微軟數(shù)據(jù)庫(kù)命名規(guī)范_第4頁(yè)
微軟數(shù)據(jù)庫(kù)命名規(guī)范_第5頁(yè)
已閱讀5頁(yè),還剩4頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、Database Naming Conventions Version 1.1數(shù)據(jù)庫(kù)命名協(xié)議 版本1.1野人翻譯2008年3月16日Last Revised May 13, 2004 by Jason MaussJason Mauss2004年5月13日修訂版The main goal of adopting a naming convention for database objects is so that you and others can easily identify the type and purpose of all objects contained in the data

2、base. 為數(shù)據(jù)庫(kù)對(duì)象編寫(xiě)命名協(xié)議的目的,就是能夠輕松的定義數(shù)據(jù)庫(kù)中全部對(duì)象。The information presented here serves as a guide for you to follow when naming your database objects. 這里提到的內(nèi)容可以作為數(shù)據(jù)庫(kù)對(duì)象命名的指導(dǎo)。When reading these rules and guidelines remember thatconsistentnamingcan bethe most important rule to follow. 當(dāng)閱讀此文涉及的規(guī)范和原則時(shí),請(qǐng)牢記始終規(guī)范的命名方

3、法是數(shù)據(jù)庫(kù)設(shè)計(jì)的最重要原則。Keep in mind that followingthe guidelines as outlined in this documentcan stillproduce long and crypticnames,ultimately, your unique situation will dictate the reasonability of your naming convention.請(qǐng)注意根據(jù)此協(xié)議的原則做出的數(shù)據(jù)庫(kù)對(duì)象的命名相對(duì)較長(zhǎng)并具有相關(guān)的意義,具體命名需要依照你個(gè)人及開(kāi)發(fā)環(huán)境的情況。The goal of this particular nam

4、ing convention is to produce practical, legible, concise, unambiguous and consistent names for your database objects.此命名協(xié)議的制定目的,是提供較為形象、易讀、簡(jiǎn)單、明確和原則性一致的數(shù)據(jù)庫(kù)命名方法。While most databases contain more types of objects than those discussed here (User Defined Types, Functions, Queries, etc.), the 7 types of o

5、bjects mentioned here are common among all major database systems. Think of this as a generic DBMS-neutral guide for naming your objects. 當(dāng)然,數(shù)據(jù)庫(kù)涉及到的對(duì)象比這里討論的更多(例如用戶自定義的、函數(shù)、查詢等),這里提到的7種對(duì)象涵蓋了大多數(shù)數(shù)據(jù)庫(kù)系統(tǒng)的內(nèi)容。所以請(qǐng)將此協(xié)議作為“中性數(shù)據(jù)庫(kù)”的命名指導(dǎo)。The following types of database objects are discussed here:這里討論下列數(shù)據(jù)庫(kù)對(duì)象:1. Tabl

6、es 表 2. Columns (incl. Primary, Foreign and Composite Keys) 列(包括主鍵、外鍵和復(fù)合鍵) 3. Indexes 索引 4. Constraints 參數(shù) 5. Views 視圖 6. Stored Procedures 存儲(chǔ)過(guò)程 7. Triggers 觸發(fā)器ALL DATABASE OBJECTS全部數(shù)據(jù)庫(kù)對(duì)象命名的統(tǒng)一規(guī)則 Limit the name to 30 characters (shorter is better) 限制名稱(chēng)在30個(gè)字母以內(nèi)(越短越好) Use only letters or underscores (t

7、ry to avoid numbers) 僅僅使用字母和下劃線(盡量避免數(shù)字命名) Try to use underscore characters as little as possible. 盡量減少使用下劃線PascalCase notation achieves the same word separation without them. PascalCase標(biāo)記法可以做到在不使用下劃線的情況下分割單詞 Use a letter as the first character of the name. (dont start names with underscores) 不要以下劃線作

8、為名稱(chēng)的字母 Avoid abbreviations (can lead to misinterpretation of names) 避免使用所寫(xiě)(可能引起誤解) Avoid acronyms (some acronyms have more than one meaning eg. ASP) 避免使用縮寫(xiě)(因?yàn)橐恍┛s寫(xiě)例如ASP,有特定意義和用途) Makes the name readable (they shouldnt sound funny when read aloud) 確保名稱(chēng)可朗讀 Avoid using spaces in names even if the system

9、 allows it. 無(wú)論是否系統(tǒng)允許都避免使用空格11. TABLES表When naming your database tables, give consideration to other steps in the development process. 當(dāng)為你的表命名時(shí),請(qǐng)同時(shí)考慮到后續(xù)開(kāi)發(fā)的各個(gè)環(huán)節(jié)。Keep in mind you will most likely have toutilize the names you give your tables several times as part of other objects, for example, procedur

10、es, triggers or views may all contain references to the table name. 請(qǐng)記住你很有可能在后續(xù)開(kāi)發(fā)其他對(duì)象,如存儲(chǔ)過(guò)程、觸發(fā)器或者視圖時(shí)多次用到你所命名的表的名稱(chēng),并作為相關(guān)參數(shù)使用。You want to keep the name as simple and short as possible. 所以盡量使用簡(jiǎn)單短小的單詞。Some systems enforce character limits on object names also. 甚至一些系統(tǒng)強(qiáng)制限制對(duì)象名稱(chēng)的單詞長(zhǎng)度。For example, in Oracle

11、you are limited to about 30 characters per object.例如Oracle限制名稱(chēng)長(zhǎng)度為30字母以內(nèi)。Rule 1a (Plural Names復(fù)數(shù)原則) - Table names should be plural, for example, Customers instead of Customer. 表的名稱(chēng)應(yīng)該為復(fù)數(shù)。Thisrule is applicablebecause tables are logical collections of one or more entities as records - just like collect

12、ion classes are logical collections of one or more objects. 因?yàn)楸戆撕芏鄶?shù)量的實(shí)體記錄。If you were to first draw an abstract data model like a NIAM/ORM model, you might have singular entity names like Customer or User but, they should be changed tothe plural formwhen building the actual tables.盡管當(dāng)你在建立數(shù)據(jù)庫(kù)NIAM/O

13、RM模型時(shí),可能使用單數(shù)形式表示實(shí)例,但是當(dāng)建立具象事物表時(shí),要使用復(fù)數(shù)名稱(chēng)。For table names with multiple words, only the last word should be plural, for example, UserRoles and UserRoleSettings.當(dāng)由詞組命名時(shí),將最后一個(gè)單詞變?yōu)閺?fù)數(shù)。譯者按:復(fù)數(shù)命名法一般情況下不可取,在長(zhǎng)度,表述方面不佳,作者本身也承認(rèn)使用復(fù)數(shù)命名的情況較少Rule 1b (Prefixes前綴) - Used correctly, table prefixes can help you organize

14、your tables into related groups or distinguish them from other unrelated tables. 正確的使用前綴能夠幫助你識(shí)別表所處的分組或者和其他的表容易區(qū)分。Used poorly, they can cause you to have to type a lot of unnecessary characters. 使用前綴是避免使用復(fù)雜修飾、限制性詞匯輔助命名的好方法。Well discuss what not to do first. 首先我們討論被禁止的做法。Do not give your table names p

15、refixes like tbl or TBL_ as these are just redundant and unnecessary. 不要使用tbl”或者TBL,因?yàn)檫@種方法多余且不必須。It will be obvious which names are the table names in SQL statements because they will always be proceeded by the FROM clause of the SELECT statement. 因?yàn)樵谶x擇查詢語(yǔ)句中表名緊跟在FROM的后面。Not all prefixes are bad.不是所有

16、的前綴都不可取。 In some cases, your tables might be sharing a schema/database with other tables that are not related in any way. 在某些情況下,表可能被一些數(shù)據(jù)庫(kù)共享引用,但是此表與其它的表沒(méi)有任何關(guān)系。In this case, it is sometimes a good idea to prefix your table names with some characters that group your tables together. 這時(shí),前綴可以將同類(lèi)的表分組。For

17、 example, for a healthcare application you might give your tables an Hc prefix so that all of the tables for that application would appear in alphabetized lists together.例如,對(duì)于醫(yī)療保健方面的應(yīng)用程序,可以用Hc開(kāi)頭,好處是能夠系統(tǒng)能夠?qū)⑾嗤腍C開(kāi)頭的表排列在一起,做到分組查看。 Note that even for the prefix, use Pascal Case. 注意前綴也是PascalCase命名法。This

18、 is discussed in Rule 1c. Do not use underscores in your prefixes, which is discussed in more depth in Rule 1d. 同樣根據(jù)Rule 1c原則,不要使用下劃線。The last kind of prefix that is acceptable is one that allows you to group logical units of tables. 最后一種能夠使用前綴的條件是分組邏輯表單元。A plausible example could entail a large app

19、lication (30 to 40+ tables) that handled both Payroll and Benefits data. 例如涉及到30到40個(gè)以上表的應(yīng)用程序,其中包括例如支出和盈利2大部分?jǐn)?shù)據(jù)。You could prefix the tables dealing with payroll with a Pay or Prl prefix and give the tables dealing with benefits data a Ben or Bfts prefix. 這時(shí)可以以Pay或者Prl作為支出類(lèi)表的前綴,Ben或者Bfts作為盈利類(lèi)表的前綴。The

20、goal of both this prefix and the aforementioned shared schema/database prefix is to allow you to group specific tables together alphabetically in lists and distinguish them from unrelated tables. 當(dāng)然這些前綴的使用目的都是要使系統(tǒng)能夠自動(dòng)分組同類(lèi)表的位置。Lastly, the shared schema/database prefix is a higher grouping level and c

21、omes first in the name, for example, HcPayClients not PayHcClients.最后,當(dāng)使用符合前綴時(shí),需要將表示大類(lèi)的前綴排在前,小類(lèi)前綴續(xù)后,如“醫(yī)療保健支出聯(lián)系人”而不是“支出醫(yī)療保健聯(lián)系人”。Rule 1c (Notation表示法) - For all parts of the table name, including prefixes, use Pascal Case. 所有的表名,包括前綴,都使用PascalCase拼寫(xiě)法。Using this notation will distinguish your table nam

22、es from SQL keywords (all capital letters). 這種方法能夠使表名和SQL語(yǔ)句全部大寫(xiě)的關(guān)鍵字區(qū)分開(kāi)。For example, SELECT CustomerId_Pk, CustomerName FROM MyAppGroupTable WHERE CustomerName = %S shows the notation for the table name distinguishing it from the SQL keywords used in the query. 例如此語(yǔ)句的區(qū)分比較明晰。PascalCase also reduces th

23、e need for underscores to visually separate words in names.同時(shí)這種表示法減少了下劃線的使用。Rule 1d (Special Characters特殊字) - For table names, underscores should not be used.表名不能在下劃線。 The underscore character has a place in otherobject names but, not for tables. 下劃線有其它的用法,但是不能在表命名里出現(xiàn)。Using Pascal Case for your tabl

24、e name allows for the upper-case letter to denote the first letter of a new word or name. 表命名應(yīng)該以PascalCase作為命名方法,即首字母大寫(xiě)表示下一個(gè)單詞的起始。Thus there is no need to do so with an underscore character. 所以就沒(méi)有必要再用下劃線表示單詞起始了。Do not use numbers in your table names either. 同時(shí)不能用數(shù)字作為表名。This usually points to a poorl

25、y designed data model or irregularly partitioned tables. 數(shù)字表名一般特指失敗的數(shù)據(jù)設(shè)計(jì)模型或者非常規(guī)表。Do not use spaces in your table names either. 同時(shí)不能使用空格作為表名。While most database systems can handle names that include spaces, some systems require you to add more characters around the name when referencing it (like tabl

26、e name for example) which goes against the rule of keeping things as short and simple as possible.當(dāng)然大部分的數(shù)據(jù)庫(kù)系統(tǒng)允許表名空格的存在,但是至少空格會(huì)增加名稱(chēng)長(zhǎng)度,不符合簡(jiǎn)短命名原則。 If you are developing in a non-english language, do not use any of that languages special characters.如果使用非英語(yǔ)命名,不要使用非英語(yǔ)字符。Rule 1e (Abbreviations縮寫(xiě)) - Avoid u

27、sing abbreviations if possible.盡量避免縮寫(xiě) Use Accounts instead of Accts and Hours instead of Hrs. 使用全拼不用縮寫(xiě)單詞。Not everyone will always agree with you on what your abbrevations stand for - and - this makes it simple to read and understand for both developers and non-developers. 對(duì)于同開(kāi)發(fā)小組其他成員和用戶來(lái)講,縮寫(xiě)并非容易讀懂和認(rèn)

28、同。This rule can be relaxed for junction table names (See Rule 1f). 此原則同樣在Rule1f原則出現(xiàn),涉及到交叉表名。Do not use acronyms.同時(shí)避免任何形式的縮寫(xiě)前綴單詞。Rule 1f (Junction a.k.a Intersection Tables交叉表) - Junction tables, which handle many to many relationships, should be named by concatenating the names of the tables that ha

29、ve a one to many relationship with the junction table. 交叉表應(yīng)當(dāng)以其表述的連鎖意義來(lái)命名。For example, you might have Doctors and Patients tables. 例如有“醫(yī)生”和“病人”2個(gè)表。Since doctors can have many patients and patients can have many doctors (specialists) you need a table to hold the data for those relationships in a junct

30、ion table. This table should be namedDoctorsPatients. 因?yàn)獒t(yī)生可能有很多病人,同時(shí)每個(gè)病人有不同科目的醫(yī)生,所以交叉表名應(yīng)該為“醫(yī)生病人”。Since this convention can result in lengthy table names, abbreviations sometimes may be used at your discretion.考慮到交叉表名的長(zhǎng)度,可以謹(jǐn)慎考慮縮寫(xiě)。2. COLUMNS列 - (incl. PRIMARY, FOREIGN, AND COMPOSITE KEYS包括主鍵,外鍵和復(fù)合鍵)Wh

31、en naming your columns, keep in mind that they are members of the table, so they do not need the any mention of the table name in the name. 列是表的組成部分,所以不要在其中涉及表名。The primary key field is typically the only exception to this rule where including the table name is justified so that you can have a more

32、descriptive field name than just Id. 主鍵是唯一可以包括表名的,具備表的描述性。CustomerIdis acceptable but not required.主鍵包括表名單詞并非必要。Just like with naming tables, avoid using abbreviations, acronyms or special characters. 就像表名需要避免縮寫(xiě),全前綴縮寫(xiě)或者特殊字符。All column names should use Pascal Case to distinguish them from SQL keyword

33、s (all upper case). 所以列明要求使用PascaCase表示法區(qū)分SQL語(yǔ)句的全大寫(xiě)表示法。Rule 2a (Identity Primary Key Fields主鍵標(biāo)識(shí)列) - For fields that are the primary key for a table and uniquely identify each record in the table, the name should simply be “Id“ since, thats what it is -an identification field. 主鍵作為記錄的區(qū)分標(biāo)志,應(yīng)該以簡(jiǎn)單的Id作為列

34、名,因?yàn)槠鋬H僅是記錄的標(biāo)識(shí)字段,沒(méi)有其它任何意義。This name also maps more closely to a property name like “Id“ in your class libraries. 僅僅用Id作為主鍵列名是適合的表達(dá)方式。Another benefit of this name is that for joins you will see something like 其他的好處,例如如下的語(yǔ)句 Customers JOIN Orders ON Customer.Id = Orders.CustomerId“which allows you to av

35、oid the word “Customer“ again after the Customer table.名稱(chēng)不會(huì)發(fā)生混淆。Rule 2b (Foreign Key Fields外鍵) - Foreign key fields should have the exact same name as they do in the parent table where the field is the primary key - with one exception - the table name should be specified. 外鍵應(yīng)該和相關(guān)聯(lián)的父表主鍵命名一致,區(qū)別的是表名要放在

36、主鍵前。For example, in the Customers table the primary key field might be Id. In an Orders table where the customer id is kept, it would be CustomerId. 例如,在客戶表Customers里,主鍵可能是Id。在訂單表里,客戶Id作為外鍵列名應(yīng)該是CustomersId,父表名加父表主鍵名,并用PascalCase表示法命名。There is one exception to this rule, which is when you have more t

37、han one foreign key field per table referencing the same primary key field in another table. 一個(gè)例外情況,當(dāng)多個(gè)表里有多個(gè)外鍵指向另外一個(gè)表的同一個(gè)主鍵時(shí)。In this situation, it might be helpful to add a descriptor before the field name.在外鍵名開(kāi)頭需要添加描述性單詞。 An example of this is if you had an Address table. 當(dāng)涉及到地址表時(shí)就是如此,首先有一個(gè)表存放地址。Yo

38、umight haveanother table with foreign key fields like HomeAddressId, WorkAddressId, MailingAddressId, or ShippingAddressId.有另外一個(gè)表有多個(gè)字段表示不同用途的地址,如家庭住址,工作地址,郵件地址和送貨地址等。此時(shí)可以用帶有描述性意義的外鍵列,用以區(qū)分不同用途的地址。Rule 2c (Composite Keys復(fù)合鍵) - If you have tables with composite keys (more than one field makes up the un

39、ique value) then instead of just “Id“ you should use a descriptor before the “Id“ characters. Two fields like “ModuleId“ and “CodeId“ might make up the composite key, for example. 當(dāng)存在多個(gè)鍵綁定為一個(gè)復(fù)合鍵時(shí)作為主鍵時(shí),例如型號(hào)和代碼2列綁定標(biāo)識(shí)Id,那就使用“ModuleId“ 和 “CodeId“ 替代Id。If you dont see an “Id“ column in the table - youll

40、know that a composite key is used to uniquely identify records.當(dāng)遇到表中沒(méi)有Id列,就說(shuō)明有復(fù)合鍵作為主鍵了。Rule 2d (Prefixes前綴) - Do not prefix your fields with fld_ or Col_ as it should be obvious in SQL statements which items are columns (before or after the FROM clause). 不要使用類(lèi)似”fld_”或者”Col_”前綴表示列名,盡管看起來(lái)有道理。Including

41、 a two or three character data type prefix for the field is optional and not recommended, for example, IntCustomerId for a numeric type or VcName for a varchar type. 可以使用2到3個(gè)數(shù)據(jù)類(lèi)型作為字段前綴,但是不推薦這種做法。However, these data type abbreviations are DBMS specific and are outside the scope of this document.然而,這些

42、數(shù)據(jù)類(lèi)型縮寫(xiě)可能是數(shù)據(jù)庫(kù)關(guān)鍵字,且其用法并非此處討論范圍。Rule 2e (Data Type Specific Naming數(shù)據(jù)類(lèi)型特殊表達(dá)法) - Boolean fields should be given names like IsDeleted, HasPermission, or IsValid so that the meaning of the data in the field is not ambiguous. 布爾字段應(yīng)該以英文“是否Is”,“具有Has”等前綴表示,以防含義模糊。If the field holds date and/or time informatio

43、n, the word Date or Time should appear somewhere in the field name. 如果有日期或者時(shí)間類(lèi)型的字段,應(yīng)當(dāng)在字段名中顯示。It is sometimes appropriate to add the unit of time to the field name also, especially if the field holds data like whole numbers (3 or 20). 而且當(dāng)字段內(nèi)格式為數(shù)字時(shí),應(yīng)當(dāng)表明日期或者時(shí)間的單位。Those fields should be named like Runti

44、meHours or ScheduledMinutes.例如小時(shí)或分鐘。3. INDEXES索引Since indexes are always related to a table or view, it makes the most sense to use the name of the table or view, as well as the column(s) they index, in the index name, along with some characters that specify the type of index it is. 索引一般與表或視圖相關(guān),所以使用

45、表或者視圖的名字來(lái)命名比較恰當(dāng),索引名等同于被索引字段名。This naming convention also allows you, if looking at a list of indexes, to see the indexes ordered by table, then column, then index type.此規(guī)定在標(biāo)示索引的同時(shí),標(biāo)示了表的排序,列排序和索引類(lèi)型。Rule 3a (Naming Convention命名規(guī)則) - The naming convention for indexes follows this structure:按照如下結(jié)構(gòu)命名索引 T

46、ableName表名ColumnsIndexed被索引列U/NC/Nwhere U/N is for unique or non-unique and C/N is for clustered or non-clustered. 其中”U/N”是獨(dú)立和非獨(dú)立,”C/N”是聚合和非聚合。This naming convention is unique among database objects, so adding characters to denote it being an index, like idx is not necessary. 在數(shù)據(jù)庫(kù)對(duì)象中,索引的命名是唯一的,所以沒(méi)必要

47、用”idx”之類(lèi)的前綴作為區(qū)分標(biāo)記。The naming convention alone is self-documenting and indentifies it as an index. 命名規(guī)則本身可以自文檔化以標(biāo)記為索引。For indexes that span multiple columns, concatenate the column names.跨字段索引需要將各字段名結(jié)合來(lái)命名。ProductsIdUC indicates a unique, clustered index on the Id column of the Products table. “Produc

48、tsIdUC”標(biāo)示Product表的Id字段索引,是唯一的?!監(jiān)rderDetailsOrderIdCustomerIdNN indicates a non-unique, non-clustered index on the OrderId and CustomerId columns in the OrderDetails table. ”O(jiān)rderDetailsOrderIdCustomerIdNN 表示非唯一,非聚合索引,屬于OrderId和CustomerId列,在OrderDetails表中。Since this name is rather lengthy with both O

49、rderId and CustomerId spelled out, they could be shortened to OrdId and CustId. 符合單詞的名稱(chēng)過(guò)長(zhǎng)時(shí),可以用縮寫(xiě)。However, notice that by using Pascal Case, thus not needing to use underscores, it is possible to keep the name of a complex index to about 30 characters.然而,由于使用Pascal命名法,不要使用下劃線,就能保持名稱(chēng)在30字母內(nèi)。 Rule 3b (P

50、refixes and Suffixes前綴和后綴) - Avoid putting a prefix like idx or IDX_ before your indexes. 索引前避免使用idx或者IDX_等。This is not necessary due to the naming convention discussed in Rule 3a.依照Rule 3a的規(guī)定。A suffix of _idx or IDX is not necessary either for the same reason.后綴也是不建議使用的。4. CONSTRAINTS帶參數(shù)的字段名Constra

51、ints are at the field/column level so the name of the field the constraint is on should be used in the name. 參數(shù)是作用于字段級(jí)的,所以參數(shù)與字段名相關(guān)。The type of constraint (Check, Referential Integrity a.k.a Foreign Key, Primary Key, or Unique) should be noted also.參數(shù)類(lèi)型(檢查,指示, 整數(shù)一般指外鍵,主鍵和唯一鍵)同樣需要注明。Constraints are al

52、so unique to a particular table and field combination, so you should include the table name also to ensure unique constaint names across your set of database tables.參數(shù)對(duì)于特定的表和字段來(lái)說(shuō),也是獨(dú)特的,所以對(duì)于相對(duì)于表名,參數(shù)同樣需要確保唯一性。Rule 4a (Naming Convention命名規(guī)定) - The naming convention syntax for constraints looks like thi

53、s:參數(shù)的命名規(guī)定句法如下 constraint type參數(shù)類(lèi)型table name表名_field name字段名Examples:范例1. PkProducts_Id - primary key constraint on the Id field of the Products table產(chǎn)品表中的主鍵字段參數(shù)2.FkOrders_ProductId -foreign key constraint on the ProductId field in the Orders table訂單表中的外鍵字段參數(shù)3.CkCustomers_AccountRepId - check constra

54、int on the AccountRepId field in the Customers table賬戶代表表中的檢查字段參數(shù)The reason underscores are used here with Pascal Case notation is so that the table name and field name are clearly separated. 這里在使用Pascal命名法的同時(shí)使用了下劃線,目的是將表名和字段名區(qū)分開(kāi)來(lái)。Without the underscore, it would become easy to get confused about wh

55、ere the table name stops and the field name starts.在沒(méi)有下劃線情況下,很難區(qū)分表名和字段名的分界點(diǎn)。Rule 4b(Prefixes前綴或前綴) A two letter prefix gets applied to the constraint name depending on the type 一個(gè)2字母前綴一般應(yīng)用在以參數(shù)設(shè)定字段名前 Primary Key主鍵前綴: Pk Foreign Key外鍵前綴: Fk Check檢查鍵前綴: Ck Unique唯一鍵前綴: Un5. VIEWS視圖Views follow many of

56、the same rules that apply to naming tables.視圖和表的命名規(guī)則一致。 There are only two differences (Rules 5a and 5b). 不同點(diǎn)有2處,Rule5a和5b。If your view combines entities with a join condition or where clause, be sure to combine the names of the entities that are joined in the name of your view. 如果視圖由join或者條件查詢構(gòu)成,就需

57、要將涉及到的表名列出在視圖名。This is discussed in more depth in Rule 5b.在5b處將詳細(xì)解釋這一規(guī)則。Rule 5a (Prefixes前綴) - While it is pointless to prefix tables, it can be helpful for views.對(duì)于視圖來(lái)講,前綴有特定作用。 Prefixing your views with Vw or View is a helpful reminder that youre dealing with a view, and not a table. 以”Vw”或者”View”

58、開(kāi)頭能夠區(qū)分視圖名和表名。Whatever type of prefix you choose to apply, use at least 2 letters and not just V because a prefix should use more more than one letter or its meaning can be ambiguous. 不論使用那種前綴,但是至少要使用2個(gè)字母不是簡(jiǎn)單的“V”,避免混淆。Rule 5b (View Types) - Some views are simply tabular representations of one or more tables with a filter applied or because of security procedures (users given permissions on views instead of the underlying table(s) in some cases). 一些視圖僅僅是簡(jiǎn)單的表的條件篩選,或者處于某些安全考慮將視圖作為基礎(chǔ)表的替換。Some views are used to generate re

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論