reset password
Author Message
cysun
Posts: 2935
Posted 11:08 Nov 01, 2013 |

Here are some common problems in HW3.

1.

The type of the price column can be integer/decimal/numeric/money, but not real/float/double due to potential round errors in floating point number representation.

2.

Do not use information that is not explicitly given in the query description. For example, do not assume "this year" means 2013, "last year" means 2012, or the id of the supplier Acme Widget Suppliers is 1.

2.3

If we are in the first week of a year, extract(week from current_date) - 2 will give you -1.

2.4

last year: extract(year from date) = extract(year from current_date) - 1

within a year: date between (current_date - interval '1 year') and current_date

2.5

Alphabetic order, which would put April before January, is not "order by month".

2.8

When a part has no supplier, there won't even be an entry for the product in the catalog, so you have to do outer join (or not exists / not in).

2.9 and 2.10

See if you can tell the differences of the following:

  • any red part
  • every red part
  • some red part
  • some red parts
  • all red parts
  • only red parts