Jump to content
BrainPill

change column names of a table

Recommended Posts

My question is, if it is possible, to change the name of the column with MYSQL. (not with php)

This is my example:

mysql> select * from horses;
+------------+---------------+-----------------------+---------------------+---------------------+-----------------------------+
| num        | name          | location              | created_day         | changed_day         | key_value                    |
+------------+---------------+-----------------------+---------------------+---------------------+-----------------------------+
|          1 | Horse Riding  | http://www.camping.fr | 2017-03-30 13:40:16 | 2017-10-19 18:14:57 | Horse, Riding, Woods        |
|          2 | Horseriding77 | http://www.wine.com   | 2017-10-27 10:16:59 | 2017-10-27 10:16:59 | Outdoor, Vacances, Test |
|          3 | Horsetours45  | http://www.fake.com   | 2017-10-23 16:18:17 | 2017-10-23 16:18:17 | Outdoor, Vacances, Test |
|          4 | Horsetours57  | http://www.bing.com   | 2017-10-23 17:24:32 | 2017-10-23 17:24:32 | Outdoor, Vacances, Test |
|          5 | Horseriding48 | http://www.test.com   | 2017-10-25 09:05:18 | 2017-10-25 09:05:18 | Outdoor, Vacances, Test |
|          6 | Horseriding67 | http://www.google.uk  | 2017-10-27 10:11:18 | 2017-10-27 10:11:18 | Outdoor, Vacances, Test |
|          7 | Horseriding52 | http://www.google.es  | 2017-10-26 17:00:05 | 2017-10-26 17:00:05 | Outdoor, Vacances, Test |
|          8 | Horseriding57 | http://www.google.fr  | 2017-10-27 12:13:38 | 2017-10-27 12:13:38 | Outdoor, Vacances, Test |
+------------+---------------+-----------------------+---------------------+---------------------+-----------------------------+
8 rows in set (0.03 sec)

mysql>

the idea is that for example location as a column name is changed by mysql into other names.  

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...