Advertisement
Guest User

Untitled

a guest
May 31st, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. select
  2. s_acctbal,
  3. s_name,
  4. n_name,
  5. p_partkey,
  6. p_mfgr,
  7. s_address,
  8. s_phone,
  9. s_comment
  10. from
  11. PART,
  12. SUPPLIER,
  13. PARTSUPP,
  14. NATION,
  15. REGION
  16. where
  17. p_partkey = ps_partkey
  18. and s_suppkey = ps_suppkey
  19. and p_size = 30
  20. and p_type like '%STEEL'
  21. and s_nationkey = n_nationkey
  22. and n_regionkey = r_regionkey
  23. and r_name = 'ASIA'
  24. and ps_supplycost = (
  25. select
  26. min(ps_supplycost)
  27. from
  28. PARTSUPP,
  29. SUPPLIER,
  30. NATION,
  31. REGION
  32. where
  33. p_partkey = ps_partkey
  34. and s_suppkey = ps_suppkey
  35. and s_nationkey = n_nationkey
  36. and n_regionkey = r_regionkey
  37. and r_name = 'ASIA'
  38. )
  39. order by
  40. s_acctbal desc,
  41. n_name,
  42. s_name,
  43. p_partkey
  44. limit 100;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement