You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

demo-queries-from slides-6.sql 613B

1234567891011121314151617
  1. --Four SELECT statements without FROM clauses
  2. --Example 1: Testing a calculation
  3. SELECT 1000 * (1 + .1) AS "10% More Than 1000";
  4. --Example 2: Testing the CONCAT function
  5. SELECT "Ed" AS first_name, "Williams" AS last_name,
  6. CONCAT(LEFT("Ed", 1), LEFT("Williams", 1)) AS initials;
  7. --Example 3: Testing the DATE_FORMAT function
  8. SELECT DATE_FORMAT(CURRENT_DATE, '%m/%d/%y') AS 'MM/DD/YY',
  9. DATE_FORMAT(CURRENT_DATE, '%e-%b-%Y') AS 'DD-Mon-YYYY';
  10. --Example 4: Testing the ROUND function
  11. SELECT 12345.6789 AS value,
  12. ROUND(12345.67) AS nearest_dollar,
  13. ROUND(12345.67, 1) AS nearest_dime;