TAILIEUCHUNG - SQL PROGRAMMING STYLE- P41

SQL PROGRAMMING STYLE- P41:Im mot trying to teach you to program in SQL in this book. You might want to read that again. If that is what you wanted, there are better books. This ought to be the second book you buy, not the first. I assume that you already write SQL at some level and want to get better at it. If you want to learn SQL programming tricks, get a copy of my other book, SQL for Smarties (3rd edition, 2005). | Follow the ISO-11179 Standards Naming Conventions 17 Although not required the correlation name on a table expression can be followed by a list of new column names in parentheses. If this list is missing the correlation name inherits the names from the base tables or views in the table expression. In the case of a simple table correlation name such a list would probably be redundant because we usually want to use the original column names. In the case of a table expression correlation name such a list would probably be a good idea to avoid ambiguous column names. It also forces the programmer to trim the expression of extraneous columns that were not actually needed in the query. Exceptions If there is no obvious clear simple name for the table correlation name then use an invented name such as a single letter like X. Likewise if a computation has no immediate name then you might use an invented name. Relationship Table Names Should Be Common Descriptive Terms Rationale Tables and views can model relationships usually one-to-many or many-to-many as well as entities. If the relationship has a common name that is understood in the context then use it. There is a tendency for newbies to concatenate the names of the tables involved to build a nounce word. For example they name a table Marriages because that is the common term for that relationship rather than ManWoman HusbandsWives or something really weird. Likewise Enrollment makes more sense than Students_Courses once you start looking for the names they come easily. This concatenation falls apart when the relationship is not a simple binary one such as an escrow on a house that has a buyer a seller and a lender. Exceptions If there is no common term for the relationship you will need to invent something and it might well be a concatenation of table names. 18 CHAPTER 1 NAMES AND DATA ELEMENTS Metadata Schema Access Objects Can Have Names That Include Structure Information This rule does not apply to

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.