sql programming style - apr 2005

237 328 0
sql programming style - apr 2005

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... own or with a book that has a title like SQL for Brain-Dead Morons,” “Learn SQL in Ten Easy Lessons or Five Hard Ones,” or worse This is absurd! It takes at least five years to learn to be a master carpenter or chef Why would you believe people could become SQL gurus in a weekend? What they become is bad SQL programmers, who speak SQL in dialect from the local SQL product with a strong accent from their... www.iso.org/iso/en/ittf/PubliclyAvailableStandards/ c002349_ISO_IEC_1117 9-1 _1999(E).zip The ISO-11179 standard is broken down into six sections: 8 CHAPTER 1: NAMES AND DATA ELEMENTS 1117 9-1 : Framework for the Specification and Standardization of Data Elements Definitions 1117 9-2 : Classification for Data Elements 1117 9-3 : Basic Attributes of Data Elements 1117 9-4 : Rules and Guidelines for the Formulation of Data 1117 9-5 : Naming and Identification... for Data 1117 9-6 : Registration of Data Elements 1.2.1 ISO-11179 for SQL Rationale: Although the formal standards are good, they are very general It is handy to have a set of rules aimed at the SQL developer in his or her own language Some of the interpretations given here are the consensus of experts, as taken from newsgroups and private e-mails Taking the rules from Section ISO-1117 9-4 , a scalar data... of Good Programming with Numerous Examples to Improve Programming Style and Proficiency.” These books and others made a big difference for most of us because they taught us how to think like good programmers My goals in this book are to improve SQL programming style and proficiency To be more exact: 1 To help an individual programmer write Standard SQL without an accent or a dialect It is difficult to... popular SQL products 1.1 Table 1.1 Names 3 Identifier lengths SQL- 92 SQL- 99 IBM MS SQL Oracle Column 18 128 30 128 30 Constraint 18 128 18 128 30 Table 18 128 128 128 30 The numbers in the table are either bytes or characters A maximum character length can be smaller than a maximum byte length if you use a multibyte character set Do not use super-long names People have to read them, type them, and print... book, SQL for Smarties (3rd edition, 2005) I am trying to teach the reader how to work in logical and declarative terms, instead of in a procedural or OO manner—“Query Eye for the Database Guy,” if you will forgive a horrible contemporary pun Few, if any, SQL programmers came to SQL before learning and writing for years in a procedural or object-oriented language They then got one particular SQL product... when the structured programming revolution came along was a series of books entitled “[Pascal | FORTRAN | COBOL | BASIC] with Style: Programming Proverbs” by Henry Ledgard and some of his colleagues at MIT The covers were done like a Victorian novel with angels, scrolls, and old -style typographical elements And like a Victorian novel, the books were subtitled “Principles of Good Programming with Numerous... Psychology Programming Considerations 203 204 Index 207 About the Author 217 Introduction I AM NOT 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. .. Software Engineering 8.2.1 Cohesion 8.2.2 Coupling Use Classic Structured Programming 8.3.1 Cyclomatic Complexity Avoid Portability Problems 8.4.1 Avoid Creating Temporary Tables 8.4.2 Avoid Using Cursors 8.4.3 Prefer Set-Oriented Constructs to Procedural Code Scalar versus Structured Parameters Avoid Dynamic SQL 8.6.1 Performance 8.6.2 SQL Injection Heuristics 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 9.10 9.11... Unicode and so does not have this problem Intermediate SQL- 92 does not allow an identifier to end in an underscore It is also not a good idea to put multiple underscores together; modern printers make it difficult to count the number of underscores in a chain Exceptions: None 1.1.3 Avoid Quoted Identifiers Rationale: 1.1 Names 5 This feature was added to SQL- 92 Its main use has been to alias column names to .

Ngày đăng: 10/04/2014, 09:40

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan