超級SQL STATEMENT問題(請求天才)....

來源: 中華之聲 2010-02-10 19:01:19 [] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (1148 bytes)
超級SQL STATEMENT問題(請求天才)

NOTE: please solve problem using plain SQL only, not a PL/SQL program

You have SQL table "table" with two columns: "name" and "gadget".
Both columns are text strings.

name | gadget
--------+-------------
mike | computer
mike | computer
mike | keyboard
mike | mouse
steve | computer
steve | phone
anton | computer
anton | keyboard
anton | mouse
anton | TV
alex | TV
alex | mouse
alex | phone
alex | computer


Person's name is given as the input argument.
Please write SQL statement which returns names of persons having unique set of gadgets which is equivalent or wider/bigger than the set of gadgets of given person.

Examples:

input: mike
output: anton
Mike has (computer, keyboard, mouse).
Anton has more gadgets (computer, keyboard, mouse) + TV.

input: steve
output: alex
Steve has (phone, computer).
Alex has (phone, computer) + TV + mouse.
Mike, Anton aren't printed - they do not have phone.

input: alex
output:

所有跟帖: 

回複:超級SQL STATEMENT問題(請求天才).... -今古- 給 今古 發送悄悄話 (530 bytes) () 02/10/2010 postreply 22:09:58

回複:超級SQL STATEMENT問題(請求天才).... Qeustion? -中華之聲- 給 中華之聲 發送悄悄話 (146 bytes) () 02/11/2010 postreply 06:34:14

回複:回複:超級SQL STATEMENT問題(請求天才).... Qeustion? -今古- 給 今古 發送悄悄話 (115 bytes) () 02/11/2010 postreply 21:28:57

回複:回複:超級SQL STATEMENT問題(請求天才).... -J43- 給 J43 發送悄悄話 (10 bytes) () 02/11/2010 postreply 11:50:15

Very good one. -pj- 給 pj 發送悄悄話 (0 bytes) () 02/12/2010 postreply 06:42:13

回複:超級SQL STATEMENT問題(請求天才).... -o.oooo1- 給 o.oooo1 發送悄悄話 (1221 bytes) () 02/21/2010 postreply 10:36:54

請您先登陸,再發跟帖!

發現Adblock插件

如要繼續瀏覽
請支持本站 請務必在本站關閉/移除任何Adblock

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

安裝Adblock plus用戶請點擊瀏覽器圖標
選擇“Disable on www.wenxuecity.com”

安裝Adblock用戶請點擊圖標
選擇“don't run on pages on this domain”