Đang chuẩn bị liên kết để tải về tài liệu:
SQL Anywhere Studio 9- P4
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'sql anywhere studio 9- p4', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 186 Chapter 5 Deleting SELECT customer.id AS cust_id customer.company_name sales_order.id AS order_id sales_order.order_date employee.emp_id STRING employee.emp_fname employee.emp_lname AS emp_name sales_order_items.line_id FROM customer INNER JOIN sales_order ON sales_order.cust_id customer.id INNER JOIN employee ON employee.emp_id sales_order.sales_rep INNER JOIN sales_order_items ON sales_order_items.id sales_order.id WHERE STRING employee.emp_fname employee.emp_lname IN Rollin Overbey Philip Chin AND customer.company_name IN The Power Group Darling Associates AND sales_order.order_date 2000-12-31 ORDER BY 1 2 3 4 5 6 7 Here s what the SELECT returns data from 11 different sales_order_item rows in five different orders five different values of order_id . It also shows that the correct company name order date and employee name are being selected. cust_id company_name order_id order_date emp_id emp_name line_id 101 The Power Group 2001 2000-03-16 299 Rollin Overbey 1 101 The Power Group 2001 2000-03-16 299 Rollin Overbey 2 101 The Power Group 2001 2000-03-16 299 Rollin Overbey 3 101 The Power Group 2206 2000-04-16 299 Rollin Overbey 1 101 The Power Group 2206 2000-04-16 299 Rollin Overbey 2 101 The Power Group 2206 2000-04-16 299 Rollin Overbey 3 101 The Power Group 2206 2000-04-16 299 Rollin Overbey 4 101 The Power Group 2279 2000-07-23 299 Rollin Overbey 1 103 Darling Associates 2340 2000-09-25 299 Rollin Overbey 1 103 Darling Associates 2451 2000-12-15 129 Philip Chin 1 103 Darling Associates 2451 2000-12-15 129 Philip Chin 2 Two DELETE statements are required one for sales_order and one for sales_order_items because each DELETE can only affect a single table. The DELETE for sales_order_items must come first because it is the child table in a foreign key relationship with sales_order. Here s what the first DELETE looks like it has exactly the same FROM and WHERE clauses as the SELECT above DELETE sales_order_items FROM customer INNER JOIN sales_order ON .