melvynmyers
asked on
MySQL - Changing order of fields
Hi!
What's the best way of changing the order of fields in a MySQL database.
eg. There are 4 fields in a table.
id
surname
firstname
password
How do you change the order to...
id
password
firstname
surname
Cheers,
Mel
What's the best way of changing the order of fields in a MySQL database.
eg. There are 4 fields in a table.
id
surname
firstname
password
How do you change the order to...
id
password
firstname
surname
Cheers,
Mel
ASKER
The main reason is for commands like...
INSERT INTO table VALUES ('abc','123','etc','etc');
It makes life a little easier for me.
Cheers,
Mel
INSERT INTO table VALUES ('abc','123','etc','etc');
It makes life a little easier for me.
Cheers,
Mel
If you build the view(s) as i mentionned, you should be able to insert into the view also...
Not sure because i'm not MySQL expert, but that works for all the databases i know of (SQL Server, Oracle, Access)
CHeers
Not sure because i'm not MySQL expert, but that works for all the databases i know of (SQL Server, Oracle, Access)
CHeers
So what's wrong with giving a column list?
INSERT INTO table (id, password, firstname,surname)
VALUES ('abc','123','etc','etc');
Arjan
INSERT INTO table (id, password, firstname,surname)
VALUES ('abc','123','etc','etc');
Arjan
ASKER
angel, I don't believe MySQL supprts views.
Arjan, thanks for your input. Your solution will work, but ideally I still want to change the field order.
Cheers!
Arjan, thanks for your input. Your solution will work, but ideally I still want to change the field order.
Cheers!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- Answered by: angelIII
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
Nic;o)
Question has been closed as per recommendation
JGould-EE Moderator
JGould-EE Moderator
I'm not sure, but MySQL should support views, in which you can order the fields as you like, and issue the SELECT * FROM YourView as you want...
CHeers