電子工業出版社 SHING HOUSE DF ELECTRONCS WHERE advance >ANY (SELECT advance FRoM publishers INNER JOIN titles ON titles. pub id publishers. pub id AND pub name = 'New Moon Books') ORDER BY advance 运行结果 Is Anger the Enemy? 2275,0000 Emotional Security: A New Algorithm 4000.0000 Fifty Years in Buckingham Palace Kitchens 4000.0000 The Busy Executive s Database Guide Cooking with Computers: Surreptitious Balance Sheets 5000.0000 Straight Talk About Computers Life Without Fear Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean 7000 0000 Computer Phobic AND Non-Phobic Individuals: Behavior Variations 7000 0000 But Is It User Friendly? 7000.0000 Secrets of Silicon Valley 8000.0000 Sushi, Anyone? 8000.0000 You Can Combat Computer Stress! 10125.0000 The Gourmet Microwave 15000.0000 (所影响的行数为14行) 此例中,首先, SeLECt advance from publishers inner join titles on titles. pub id = publishers. pub id and pub name=' New moon books’子查询返回了 New Moon books 出版社的所有书籍的预付款(2000.0000,2275.00,400000,6000.000,10125.0000,而 ANY关键字的含义是任何一个值,所以>ANY的取值为大于集合中的最小值,即>2000.0000 然后外部查询 seleCt title, advance from titles Where advance>2000.0000语句查询出 最后结果 【例6.37】在样例数据库pubs中,查询作者收到的预付款大于 New moon books出版 社支付的最高预付款金额的书名及预付款 USE pubs select title, advance from titles WHERE advance >ALL (SELECT advance FROM publishers INNER JOIN titles ON titles. pub _id publishers. pub id AND pub name =New Moon Books') ORDER BY advance 运行结果 The Gourmet Microwave 15000.0000 (所影响的行数为1行WHERE advance > ANY (SELECT advance FROM publishers INNER JOIN titles ON titles.pub_id = publishers.pub_id AND pub_name = 'New Moon Books') ORDER BY advance 运行结果: title advance ------------------------------------------------------------------------------- Is Anger the Enemy? 2275.0000 Emotional Security: A New Algorithm 4000.0000 Fifty Years in Buckingham Palace Kitchens 4000.0000 The Busy Executive's Database Guide 5000.0000 Cooking with Computers: Surreptitious Balance Sheets 5000.0000 Straight Talk About Computers 5000.0000 Life Without Fear 6000.0000 Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean 7000.0000 Computer Phobic AND Non-Phobic Individuals: Behavior Variations 7000.0000 But Is It User Friendly? 7000.0000 Secrets of Silicon Valley 8000.0000 Sushi, Anyone? 8000.0000 You Can Combat Computer Stress! 10125.0000 The Gourmet Microwave 15000.0000 (所影响的行数为 14 行) 此例中, 首先,SELECT advance FROM publishers INNER JOIN titles ON titles.pub_id = publishers.pub_id AND pub_name = 'New Moon Books'子查询返回了 New Moon Books 出版社的所有书籍的预付款(2000.0000,2275.0000,4000.0000,6000.0000,10125.0000),而 ANY 关键字的含义是任何一个值,所以>ANY 的取值为大于集合中的最小值,即>2000.0000; 然后外部查询 SELECT title, advance FROM titles WHERE advance>2000.0000 语句查询出 最后结果。 【例 6.37】在样例数据库 pubs 中,查询作者收到的预付款大于 New Moon Books 出版 社支付的最高预付款金额的书名及预付款。 USE pubs SELECT title, advance FROM titles WHERE advance >ALL (SELECT advance FROM publishers INNER JOIN titles ON titles.pub_id = publishers.pub_id AND pub_name = 'New Moon Books') ORDER BY advance 运行结果: title advance -------------------------------------------------- The Gourmet Microwave 15000.0000 (所影响的行数为 1 行)