PDA

View Full Version : editing and amendment of DB or its tables.


bazz
07-27-2007, 08:20 PM
Hi again,

As you might know I am just getting started now on my MySQL Db proper.

To assist with my comparitively low confidence levels, I ask this question....

If I set up the DB or any of its tables ot their fields wrongly, is it a straightforwadr matter of changing various values via phpMyAdmin or by coding directly, without losing any data or other tables settings?

I hope so, so that I can make a bit more progress. Y'see, i think I have my hand written tables normalised but I haven't yet spent much time learning how to setup each table and the fields in each.

bazz

zro@rtv
07-27-2007, 09:59 PM
you should be able to edit tables with phpMyAdmin very easily, and not necessarily loose any data.

I would suggest setting up a 'test' DB, and experimenting with phpMyAdmin more.

bazz
07-28-2007, 12:12 AM
Thanks.

Now, why didn't I think of that :rolleyes:

bazz

guelphdad
07-28-2007, 03:27 AM
you do have to be a bit careful. if for instance you have a char(50) field and have some rows with 50 characters but changed your table to varchar(40) then those fields would be truncated.

similar with int type fields, if you have very large values but change them to a smaller type those values could also get truncated.

bazz
07-28-2007, 11:41 AM
Thanks very much guelphdad. I have used values which I think are high enough and shall try to remember never, to shorten them. Indeed, they may have to be lengthened.

As for the text field is it better to use tinytext or to use text(20)?

bazz

guelphdad
07-28-2007, 02:54 PM
well text(20) doesn't work like you think it does probably. the (20) I believe specifies the size of the index, here the first 20 characters are indexed. is that your understanding or were you thinking it limited your entire field to 20 characters?

also have you seen this chart (http://codingforums.com/showpost.php?p=540233&postcount=6) for a quick reference on the size of values or amount of text that can go into a field?

bazz
07-28-2007, 02:58 PM
hey; now that is useful. I hadn't seen it before and I think I will be seeing a lot more of it in the next few days/weeks.
I had overlooked the stickies :(
Thanks for that

bazz