TAILIEUCHUNG - SQL Clearly Explained- P10

SQL Clearly Explained- P10: You don’t need to be a database designer to use SQL successfully. However, you do need to know a bit about how relational databases are structured and how to manipulate those structures. | 414 Chapter 19 Object-Relational Support retrieve just the value of a single column we use dot notation. The first portion DEREF related_ingredient actually performs the dereference. The portion to the right of the dot specifies the column in the referenced row. Some DBMSs provide a dereference operator - that can be used in place of the DEREF function. The preceding query might be written SELECT related_ingredient- ingredient_name amount FROM ingredient_amount Methods The UDTs that we have seen to this point have attributes but not methods. It is certainly possible however to declare methods as part of a UDT and then to use SQL programming to define the body of the methods. Like classes used by OO programming languages such C SQL the body a method is defined separately from the declaration of the UDT. You declare a method after declaring the structure of a UDT. For example we could add a method to display the instructions of a recipe with CREATE TYPE recipe_type AS OBJECT recipe_name CHAR 256 instruction_list instruction ARRAY 20 numb_servings INT NOT INSTANTIABLE NOT FINAL METHOD show_instructions This particular method does not return a value and the declaration therefore does not include the optional RETURNS clause. However a method to compute the cost of a recipe if we were to include ingredient costs in the database could be declared as Methods 415 CREATE TYPE recipe_type AS OBJECT recipe_name CHAR 256 instruction_list instruction ARRAY 20 numb_servings INT NOT INSTANTIABLE NOT FINAL METHOD show_instructions METHOD compute_cost RETURNS DECIMAL 5 2 Methods can accept input parameters within the parentheses following the method name. A method declared as METHOD scale_recipe IN numb_servings INT accepts an integer value as an input value. The parameter list can also contain output parameters OUT and parameters used for both input and output INOUT . As mentioned earlier although methods are declared when UDTs tables are declared the bodies of methods are written

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.