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 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 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 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. 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
Archived
This topic is now archived and is closed to further replies.