超級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問題(請求天才)....
所有跟帖:
• 回複:超級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- ♂ (10 bytes) () 02/11/2010 postreply 11:50:15
• Very good one. -pj- ♂ (0 bytes) () 02/12/2010 postreply 06:42:13
• 回複:超級SQL STATEMENT問題(請求天才).... -o.oooo1- ♂ (1221 bytes) () 02/21/2010 postreply 10:36:54