超級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”