SQL PROGRAMMING STYLE- P23

SQL PROGRAMMING STYLE- P23: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). | Pick Standard Constructions over Proprietary Constructions 107 SELECT . FROM Orders AS O1 OrderDetails AS D1 WHERE AND mens wear New style SELECT . FROM Orders AS O1 INNER JOIN OrderDetails AS D1 ON AND mens wear Mixed style SELECT . FROM Orders AS O1 INNER JOIN OrderDetails AS D1 ON WHERE mens wear Exceptions The infixed join operators must be used if there is an OUTER JOIN in the FROM clause. The reason is that the order of execution matters with OUTER JOINs and you can control it better with parentheses and predicates if they are all together. As a rule of thumb when you have a FROM clause with five or more tables in it the traditional syntax is probably easier to read than trying to visually match the ON clauses to the proper tables and correlation names. This rule of five is mentioned in other places as a limit on human data processing ability. Use ISO Temporal Syntax Rationale The only display format allowed for temporal data in Standard SQL is based on ISO-8601 and it is the yyyy-mm-dd hh mm style. The Federal Information Processing Standards FIPS require at least five decimal places of precision in the seconds. Anything else is ambiguous 108 CHAPTER 6 CODING CHOICES and not acceptable if you want to work with other software that follows ISO standards. Standard SQL defines a minimal set of simple temporal math operators. All of them are available in all SQL products but the syntax varies. For example in the T-SQL dialect the function call DATEADD DD 13 birthdate adds 13 days to the date in birthdate. The Standard SQL syntax for the same calculation is birthdate INTERVAL 13 DAY instead. You can set the display to ISO-8601 in every SQL product and you can do percent of your temporal work without any proprietary temporal functions. The problem is that porting code can be a bother. You need to make

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.