選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

demo-queries-from slides-3.sql 600B

1234567891011121314151617181920
  1. --A SELECT statement that calculates the balance due
  2. SELECT invoice_total, payment_total, credit_total,
  3. invoice_total - payment_total - credit_total AS balance_due
  4. FROM invoices;
  5. --Use parentheses to control the sequence of operations
  6. SELECT invoice_id,
  7. invoice_id + 7 * 3 AS multiply_first,
  8. (invoice_id + 7) * 3 AS add_first
  9. FROM invoices
  10. ORDER BY invoice_id;
  11. --Use the DIV and modulo operators
  12. SELECT invoice_id,
  13. invoice_id / 3 AS decimal_quotient,
  14. invoice_id DIV 3 AS integer_quotient,
  15. invoice_id % 3 AS remainder
  16. FROM invoices
  17. ORDER BY invoice_id;