Re: SET vs. ENUM
Hello Jerry and Martijn sets contains an iterator so you can iterate thru the objects also supports the contains method set.contains(new String(foo)) http://www.docjar.com/docs/api/java/util/Set.html Enums must use the exact index and are generally use for fixed constant Array http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html I fail to see what this has to do with MySQL? Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle MS SQL Server Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SET vs. ENUM
Jerry, Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? Well, they are -different things- ... SETs shouldn't be used at all, IMO. ENUM can be somewhat useful, I guess. Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: SET vs. ENUM
-Original Message- From: Martijn Tonies [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 9:51 AM To: mysql@lists.mysql.com Subject: Re: SET vs. ENUM Jerry, Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? Well, they are -different things- ... SETs shouldn't be used at all, IMO. [JS] Why? ENUM can be somewhat useful, I guess. Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] infoshop.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SET vs. ENUM
Jerry, Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? Well, they are -different things- ... SETs shouldn't be used at all, IMO. [JS] Why? It goes against normalizing your data, that's why. You cannot query them properly, that's why (just check the archives of this list). You cannot add a possible value (same goes for ENUM) without a DDL statement, so data is intertwined with metadata, which is bad. The metadata is not portable to other systems (neither is ENUM). ENUM can be somewhat useful, I guess. Need more reasons? :-) Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle MS SQL Server Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SET vs. ENUM
On Thu, Jul 31, 2008 at 9:46 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? The only use for ENUM is to make your data smaller. It offers no protection against illegal values and can't be updated without copying the table. If you want to constrain values, a better approach is to make your tables InnoDB and use a lookup table with a foreign key constraint. - Perrin -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SET vs. ENUM
On Thu, 2008-07-31 at 11:24 -0400, Perrin Harkins wrote: On Thu, Jul 31, 2008 at 9:46 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? The only use for ENUM is to make your data smaller. It offers no protection against illegal values and can't be updated without copying the table. If you want to constrain values, a better approach is to make your tables InnoDB and use a lookup table with a foreign key constraint. - Perrin I don't see how that can be; with ENUM the DB has to set aside enough bytes for the longest identifier. The only advantage of ENUM is that the data is in the same table; you don't have to do an extra join. It can save you some processing time. -- Just my 0.0002 million dollars worth, Shawn Where there's duct tape, there's hope. Perl is the duct tape of the Internet. Hassan Schroeder, Sun's first webmaster -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SET vs. ENUM
On Thu, Jul 31, 2008 at 11:38 AM, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote: I don't see how that can be; with ENUM the DB has to set aside enough bytes for the longest identifier. ENUMs are stored as integers. The only advantage of ENUM is that the data is in the same table; you don't have to do an extra join. You don't have to join in order to use a lookup table. You can store the actual values in the column (unlike ENUM). - Perrin -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: SET vs. ENUM
-Original Message- From: Martijn Tonies [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2008 10:32 AM To: mysql@lists.mysql.com Subject: Re: SET vs. ENUM Jerry, Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? Well, they are -different things- ... SETs shouldn't be used at all, IMO. [JS] Why? It goes against normalizing your data, that's why. You cannot query them properly, that's why (just check the archives of this list). You cannot add a possible value (same goes for ENUM) without a DDL statement, so data is intertwined with metadata, which is bad. The metadata is not portable to other systems (neither is ENUM). ENUM can be somewhat useful, I guess. Need more reasons? :-) [JS] No, you've made several good points. My reasoning is that inexperienced folks using this table through MS Access don't generally understand enough about database design to create the necessary JOINs to do it right. Perhaps the trade-off is a bad one. Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle MS SQL Server Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] infoshop.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: SET vs. ENUM
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Perrin Harkins Sent: Thursday, July 31, 2008 11:25 AM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: SET vs. ENUM On Thu, Jul 31, 2008 at 9:46 AM, Jerry Schwartz [EMAIL PROTECTED] wrote: Other than the fact that an ENUM can have many more values than a SET, is there any particular reason to choose one over the other? The only use for ENUM is to make your data smaller. It offers no protection against illegal values and can't be updated without copying the table. If you want to constrain values, a better approach is to make your tables InnoDB and use a lookup table with a foreign key constraint. [JS] Too late, I inherited this. There are a LOT of places where foreign key restraints (and cascading deletes) would save a lot of programming. I do, however, make use of full-text indexing. - Perrin -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SET vs. ENUM
Jerry Schwartz wrote: [JS] No, you've made several good points. My reasoning is that inexperienced folks using this table through MS Access don't generally understand enough about database design to create the necessary JOINs to do it right. Perhaps the trade-off is a bad one. My thought is you should develop an application that will give your users the information they need with out direct access to the DB. My thought is, if a user doesn't have a solid understanding of at least 1st and 2nd normal form, and basic joins, they should not be given direct access to the DB. Doing so would be kind of like giving a 16 year old kid the keys to a 200mph race car and say have fun. Sooner or later something bad is going to happen. Just my opinion. -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Ham Radio Repeater Database. http://hrrdb.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SET vs. ENUM
On Thu, 2008-07-31 at 11:47 -0500, Chris W wrote: My thought is you should develop an application that will give your users the information they need with out direct access to the DB. My thought is, if a user doesn't have a solid understanding of at least 1st and 2nd normal form, and basic joins, they should not be given direct access to the DB. Doing so would be kind of like giving a 16 year old kid the keys to a 200mph race car and say have fun. Sooner or later something bad is going to happen. Just my opinion. Actually, it's scarier to give access to people who know what they're doing. They're the ones who would know how to sabotage it. Access should only be granted to those who need it to do their jobs. Everyone else should be restricted to using a user interface with predefined pathways. -- Just my 0.0002 million dollars worth, Shawn Where there's duct tape, there's hope. Perl is the duct tape of the Internet. Hassan Schroeder, Sun's first webmaster -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SET vs. ENUM
Mr. Shawn H. Corey wrote: Actually, it's scarier to give access to people who know what they're doing. They're the ones who would know how to sabotage it. Access should only be granted to those who need it to do their jobs. Everyone else should be restricted to using a user interface with predefined pathways. Can't really argue with that. -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Ham Radio Repeater Database. http://hrrdb.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]