TAILIEUCHUNG - Joe Celko s SQL for Smarties - Advanced SQL Programming P9

Joe Celko s SQL for Smarties - Advanced SQL Programming P9. In the SQL database community, Joe Celko is a well-known columnist and purveyor of valuable insights. In Joe Celko's SQL for Smarties: Advanced SQL Programming, he picks up where basic SQL training and experience leaves many database professionals and offers tips, techniques, and explanations that help readers extend their capabilities to top-tier SQL programming. Although Celko denies that the book is about database theory, he nevertheless alludes to theory often to buttress his practical points. This title is not for novices, as the author points out. Instead, its intended audience. | 52 CHAPTER 1 DATABASE DESIGN domain constraint constraint name definition check constraint definition constraint attributes alter domain statement ALTER DOMAIN domain name alter domain action alter domain action set domain default clause drop domain default clause add domain constraint definition drop domain constraint definition It is important to note that a domain has to be defined with a basic data type and not with other domains. Once declared a domain can be used in place of a data type declaration on a column. The check clause is where you can put the code for validating data items with check digits ranges lists and other conditions. Since the DOMAIN is in one place you can make a good argument for writing the following CREATE DOMAIN StateCode AS CHAR 2 DEFAULT CONSTRAINT valid_state_code CHECK VALUE IN AL AK AZ . instead of CREATE DOMAIN StateCode AS CHAR 2 DEFAULT CONSTRAINT valid_state_code CHECK VALUE IN SELECT state FROM StateCodeTable The second method would have been better if you did not have a domain and had to replicate the check clause in multiple tables in the database. This would collect the values and their changes in one place instead of many. CREATE TRIGGER Statement A TRIGGER is a feature in many versions of SQL that will execute a block of procedural code against the database when a table event occurs. This Other Schema Objects 53 is not part of Standard SQL but has been proposed in the SQL3 working document. You can think of a trigger as a generalization of the referential actions. The procedural code is usually written in a proprietary language but some products let you attach programs in standard procedural languages. A trigger could be used to automatically handle discontinued merchandise for example by creating a credit slip in place of the original order item data. There is a Standard syntax for triggers based on the SQL PSM Standard but it is not widely implemented. You should look at what your particular vendor has given .

Đã 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.