TAILIEUCHUNG - Database Modeling & Design Fourth Edition- P48

Database Modeling & Design Fourth Edition- P48: Database technology has evolved rapidly in the three decades since the rise and eventual dominance of relational database systems. While many specialized database systems (object-oriented, spatial, multimedia, etc.) have found substantial user communities in the science and engineering fields, relational systems remain the dominant database technology for business enterprises. | 222 Appendix The Basics of SQL that have matching item numbers have the item numbers displayed. select item_num item_name cust_num cust_name from order where cust_num 005 intersect select item_num item_name cust_num cust_name from order where cust_num 006 item number item name customer no customer name 125 phaser 005 125 phaser 006 Gorn Khan Aggregate Functions 1. Display the total number of orders. This query uses the SQL function count to count the number of rows in table order. select count from order count order 11 2. Display the total number of customers actually placing orders for items. This is a variation of the count function and specifies that only the distinct number of customers is to be counted. The distinct modifier is required because duplicate values of customer numbers are likely to be found since a customer can order many items and will appear in many rows of table order. select count distinct cust_num from order distinct count order 9 Data Manipulation Language DML 223 3. Display the maximum quantity of an order of item number 125. The SQL maximum function is used to search the table order select rows where the item number is 125 and display the maximum value of quantity from the rows selected. select max quantity from order where item_num 125 max quantity 3 4. For each type of item ordered display the item number and total order quantity. Note that item_num and item_name in the select line must be in a group by clause. In SQL any attribute to be displayed in the result of the select command must be included in a group by clause when the result of an SQL function is also to be displayed. The group by clause results in a display of the aggregate sum of quantity values for each value of item_num and item_name. The aggregate sums will be taken over all rows with the same value of item_num. select item_num item_name sum quantity from order group by item_num item_name item number item name sum quantity 125 phaser 7 137 beam 3 143 shield 1 175 .

TỪ KHÓA LIÊN QUAN
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.