sanosuke001 Posted September 20, 2006 Share Posted September 20, 2006 I have a table with probably 200 columns. I want to view all but a handful of them. Is there a way without typing them all out in a select col1, col2 ... col200 from table; kinda way?Or better yet, how can I compare two different databases. What I am trying to do is see the differences between two databases and so far, the only thing I can think of is to print them all out to a text file and then run a diff on them. An answer for either would be awesome. Thanks for the help!Stephen Link to comment https://forums.phpfreaks.com/topic/21458-select-all-but-is-it-possible/ Share on other sites More sharing options...
fenway Posted September 21, 2006 Share Posted September 21, 2006 Not really... but you could DESCRIBE the table in PHP, get back a hash of column names, and then remove the ones you don't want, and have the script compose the desired column list. Same goes for comparisons. Link to comment https://forums.phpfreaks.com/topic/21458-select-all-but-is-it-possible/#findComment-95771 Share on other sites More sharing options...
obsidian Posted September 21, 2006 Share Posted September 21, 2006 another idea, and i'm sure fenway will have a better idea whether or not this is optimal, but if you're doing a ton of queries like that, why not split your table into two so that the most used columns are in one table? i know it's not really normalized, but the other option i can think of is to create a view with only those columns that you're wanting to select, then you only have to select * from the view.fenway, would that be a reasonable solution when you're working with so many columns? Link to comment https://forums.phpfreaks.com/topic/21458-select-all-but-is-it-possible/#findComment-95813 Share on other sites More sharing options...
sanosuke001 Posted September 21, 2006 Author Share Posted September 21, 2006 I'm not using it all that often. Even with a view, I'd have to type it all out. What I am doing is we have a device that stores patient data in a database and once in a while an error creeps into the DB. WE have to fix it and thats easy. The hard part is determining if any of the data was changed. I know its very unlikely that an update would change something other than what we told it to, but its patient data and we want to be certain. Also, we're using SQLite so I don't even know if there are views in it...Thanks for the help though. Link to comment https://forums.phpfreaks.com/topic/21458-select-all-but-is-it-possible/#findComment-96017 Share on other sites More sharing options...
fenway Posted September 21, 2006 Share Posted September 21, 2006 [quote author=obsidian link=topic=108841.msg438454#msg438454 date=1158803213]another idea, and i'm sure fenway will have a better idea whether or not this is optimal, but if you're doing a ton of queries like that, why not split your table into two so that the most used columns are in one table? i know it's not really normalized, but the other option i can think of is to create a view with only those columns that you're wanting to select, then you only have to select * from the view.fenway, would that be a reasonable solution when you're working with so many columns?[/quote]There's nothing wrong with splitting the table horizontally, and in fact with InnoDB, it often makes a lot of sense... but views have their own issues (esp. with indexing), so they have many limitations. Plus, it doesn't sound like it's going to be in constant use.I would still recommend the dynamic column listing. Link to comment https://forums.phpfreaks.com/topic/21458-select-all-but-is-it-possible/#findComment-96069 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.