TAILIEUCHUNG - Beginning Database Design- P21

Beginning Database Design- P21:This book focuses on the relational database model from a beginning perspective. The title is, therefore, Beginning Database Design. A database is a repository for data. In other words, you can store lots of information in a database. A relational database is a special type of database using structures called tables. Tables are linked together using what are called relationships. You can build tables with relationships between those tables, not only to organize your data, but also to allow later retrieval of information from the database | Business Rules and Field Settings LISTING_NUMBER_OF_BIDS LISTING_WINNING_PRICE LISTING_BID_INCREMENT BID_PRICE INTEGER FORMAT 999 NULL MONEY NULL MONEY NULL MONEY NULL The LISTING_NUMBER_OF_BIDS is output formatted as for number of bids in the OLTP database model LISTING table. Encoding Business Rules As with the previous section covering individual field business rules this section covers the case study online auction house database models but this time attempting to encode a few things into a pseudo database programming language. The intention here is to demonstrate what can be done. It is a matter for some debate among computer professionals as to whether business rules should be written into stored procedures. Some think implementing business rules in stored procedures is good for some reasons. Others consider that applications handle this type of complexity more effectively and efficiently. Encoding Business Rules for the OLTP Database Model You already know the difference between a stored procedure a stored function and an event-based trigger. What can be done to the OLTP database model for this case study to utilize some type of database stored coding The BID table is a good candidate for some basic stored functions CREATE TABLE BID LISTING CHAR 10 NOT NULL BUYER_ID INTEGER FOREIGN KEY REFERENCES BUYER NOT NULL BID_PRICE MONEY CHECK VERIFY_BID LISTING BID_PRICE NOT NULL PROXY_BID MONEY CHECK PROXY_BID BID_PRICE AND VERIFY_BID LISTING PROXY_BID NULL BID_DATE DATE FORMAT DD MON YEAR NOT NULL CONSTRAINT PRIMARY KEY LISTING BUYER_ID The preceding script has a CHECK constraint on the BID_PRICE and PROXY_BID fields. Both of these CHECK constraints execute a function. A bid price is entered by a bidder. That bid price must exceed the starting and current prices both of which are stored in the listing table. This can be encoded using a stored function as follows CREATE FUNCTION VERIFY_BID LISTNUM CHAR 10 BID MONEY DEFAULT NULL RETURN BOOLEAN DECLARE START_PRICE .

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.