tailieunhanh - SQL Anywhere Studio 9- P4

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 AS cust_id AS order_id STRING AS emp_name FROM customer INNER JOIN sales_order ON INNER JOIN employee ON INNER JOIN sales_order_items ON WHERE STRING IN Rollin Overbey Philip Chin AND IN The Power Group Darling Associates AND 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 .

TỪ KHÓA LIÊN QUAN