Jay Fisher

rearrange columns and use aliases

SQL statements for rearranging columns and assigning aliases

  • September 22, 2017 at 1:01 PM
  • Visible to public
/* Concatenated name and cost with reader friendly language and used alias of Available Materials for that column*/
SELECT concat( name, ' costs ', cost, ' per square foot.') AS "Available Materials" FROM Materials ORDER BY cost;

/* Displayed only certain columns, reordered them, concatenated vertical and horizontal dimensions into a more readable format with aliases*/
SELECT quantity AS "Quantity", concat(hor_dimens, "\' x ", vert_dimens, "\'") AS "Dimensions", cost AS "Cost" FROM Signs;