Share
, ,

MySQL: Create Custom Columns


  • Creating a custom column use the keyword CONCAT -
    SELECT CONCAT(city,',',state) FROM customers
  • Give name to the new custom column -
    SELECT CONCAT(city,',',state) AS new_info FROM customers



Notice:
  1. Full form of CONCAT is Concatenation; it takes a list of items and combine those items in a single place.
  2. When you will go to name a new custom column if there is more than one name inside the parenthesis then use ,',', marks between the existing column names like I showed in the example.
  3. For giving name to the new custom column use statement AS before the name. 



                               

0 comments:

Post a Comment