問SQL考題翻譯(1)

考題翻譯如下:

ABC.com has retail stores in a few major cities across the country.

The company wants a list of Customers who live in a city that does not have a

ABC.com store, along with the customer's City.

The result set must be sorted alphabetically by City name.

Which of the following Transact-SQL statements would return the required

information?

還請各位大大幫我翻譯,

因為我有找出單字的意思, 但整個湊起來就看不懂了??

Update:

請問 prisoner26535:

答案寫 <>ANY 為啥你的是 NOT IN 怎麼看出來的....

1 Answer

Rating
  • 6 years ago
    Favorite Answer

    很簡單啊!

    select customer.name,customer.city from customer

    where customer.city not in (select distinct store.city from store) order by customer.city;

    2014-12-12 11:17:11 補充:

    > 答案寫 <>ANY 為啥你的是 NOT IN 怎麼看出來的....

    1. 因為我很聰明啊!其實我連SQL是神東東都不知道的.看到妳的問題以後用3分鐘惡補出來的. 妳別生氣我吧?

    2. "in a city that does not have ABC.com store" 就是說"我的城市"不在 "所有有ABC.com store" 的城市 列裡面

    不是醬嗎?

Still have questions? Get your answers by asking now.