TAILIEUCHUNG - Beginning Databases with Postgre SQL phần 7

và các ngôn ngữ khác. Điều này cung cấp cơ hội cho các máy chủ cơ sở dữ liệu để thực hiện chức năng ứng dụng phức tạp một cách độc lập của khách hàng. Thủ tục lưu trữ được lưu trữ trong cơ sở dữ liệu riêng của mình và có thể được gọi là bởi ứng dụng hoặc, trong các hình thức gây nên, được gọi là tự động | __ V CHAPTER 12 DATABASE DESIGN 373 Last name and ZIP code. This is better but still not guaranteed to be unique since there could be a husband and wife who are both customers. First name last name and ZIP code. This is probably unique but again not a certainty. It s also rather messy and inefficient to need to use three columns to get to a unique key. One is much preferable though we will accept two. There is no clear candidate key for the customer table so we will need to generate a logical key that is unique for each customer. To be consistent we will always name logical keys table name _id which gives us customer_id. orderinfo table This table has exactly the same problem as the customer table. There is no clear way of uniquely identifying each row so again we will create a key orderinfo_id. item table We could use the description here but descriptions could be quite a large text string and long text strings do not make good keys since they are slow to search. There is also a small risk that descriptions might not always be unique even though they probably should be. Again we will create a key item_id. orderline table This table sits between the orderinfo table and the item table. If we decide that any particular item will appear on an order only once because we handle multiple items on the same order using a quantity column we could consider the item to be a candidate key. In practice this won t work because if two different customers order the same item it will appear in two different orderline rows. We know that we will need to find some way of relating each orderline row to its parent order in orderinfo and since there is no column present yet that can do this we know we will need to add one. We can postpone briefly the problem of candidate keys in the orderline table and come back to it in a moment. Establishing Foreign Keys After establishing primary keys you can work on the mechanism to use to relate the tables together. The conceptual model shows the .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.