Jump to content

Select all but - is it possible


sanosuke001

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

[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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.