tailieunhanh - beginning microsofl sql server 2008 programming phần 5

Mặc định là tương tự như người anh em họ của họ - một hạn chế mặc định - hơn một quy tắc là một hạn chế KIỂM TRA. Thật vậy, họ làm việc giống nhau, chỉ khác biệt thực sự trong cách mà họ được gắn vào một bảng và các mặc định (đối tượng, không hạn chế) hỗ trợ cho người dùng định nghĩa kiểu dữ liệu. | Chapter 8 Being Normal Normalization and Other Basic Design Issues Let me reiterate the importance of being sure that your customers are really considering their future needs. The PartNo column using a simple 6-character field is an example of where you might want to be very suspicious. Part numbers are one of those things that people develop new philosophies on almost as often as my teenage daughter develops new taste in clothes. Today s inventory manager will swear that s all they ever intend to use and will be sincere in it but tomorrow there s a new inventory manager or perhaps your organization merges with another organization that uses a 10-digit numeric part number. Expanding the field isn t that bad of a conversion but any kind of conversion carries risks so you want to get it right the first time. Description is one of those guessing games. Sometimes a field like this is going to be driven by your user interface requirements don t make it wider than can be displayed on the screen other times you re just going to be truly guessing at what is enough space. Here you use a variable-length char over a regular char for two reasons To save a little space So we don t have to deal with trailing spaces look at the char vs. varchar data types back in Chapter 1 if you have questions on this We haven t used an nchar or nvarchar because this is a simple invoicing system for a . business and we re not concerned about localization issues. If you re dealing with a multilingual scenario you ll want to pay much more attention to the Unicode data types. You ll also want to consider them if you re storing inherently international information such as URLs which can easily have kanji and similar characters in them. Weight is similar to Description in that it is going to be somewhat of a guess. We ve chosen a tinyint here because our products will not be over 255 pounds. Note that we are also preventing ourselves from keeping decimal places in our weight integers only . As we

crossorigin="anonymous">
Đã 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.