jonaofarc Posted March 10, 2009 Share Posted March 10, 2009 I understand that char is faster but fixed lenght variable and var char is variable lenght but those that mean that char always has to be fixed say 10 charactors and can never be more or less can anyone give me examples of when its better to use varchar or char Quote Link to comment https://forums.phpfreaks.com/topic/148815-solved-can-anyone-give-me-examples-of-when-its-better-to-use-varchar-or-char/ Share on other sites More sharing options...
rhodesa Posted March 10, 2009 Share Posted March 10, 2009 you basically said it.... VARCHAR -> Don't know the length of the input (99% of the time it will be this) CHAR -> Set length...like a US state abbreviation: NY Quote Link to comment https://forums.phpfreaks.com/topic/148815-solved-can-anyone-give-me-examples-of-when-its-better-to-use-varchar-or-char/#findComment-781495 Share on other sites More sharing options...
jonaofarc Posted March 10, 2009 Author Share Posted March 10, 2009 thanks rhodes Quote Link to comment https://forums.phpfreaks.com/topic/148815-solved-can-anyone-give-me-examples-of-when-its-better-to-use-varchar-or-char/#findComment-781579 Share on other sites More sharing options...
fenway Posted March 13, 2009 Share Posted March 13, 2009 FYI, it also depends on charset and if you ever sort on these columns, too. Quote Link to comment https://forums.phpfreaks.com/topic/148815-solved-can-anyone-give-me-examples-of-when-its-better-to-use-varchar-or-char/#findComment-783840 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.