SELECT SPLAT…To Just the Cols You Want

thatjeffsmith SQL Developer 6 Comments

Tell Others About This Story:

It’s a t-shirt!

Question: I like SELECT *, but I don’t really want ALL the columns. Is there a better way?

Side Note: People are giving me crap on the ‘SPLAT’ – it’s perfectly acceptable! To me at least…

There’s a few better ways, and with an IDE like SQL Developer, you should expect lots of help in this area.

  • drag and drop cols from the tree
  • * expansion
  • the Query Builder
  • code insight

I have how-to’s on each of those methods. Here’s a quick video I made that shows all of them, using a SELECT * on EMPLOYEES and DEPARTMENTS.

This is the first time I tried a screen recording with QuickTime on the Mac…so no fancy editing or audio. I can do fancier if you’d like, but these are hopefully pretty simple to demonstrate, pick up.

BONUS! #5: Copy Selected Column Headers

The fans demanded I include this trick as well. So click here for another method – it involves copying column names from a grid.

Right mouse on the column headers. not in the grid.

Right mouse on the column headers. not in the grid.

Tell Others About This Story:

Comments 6

  1. Hi Jeff, in query result (table grid too) I can press Ctrl+A and then copy/paste content to Excel without Export, but column names are not copied. I am aware of “BONUS! #5” feature, but this way a delimited columns list is being copied, so in Excel I have to use Text to columns split to add column names. Using Export I have to save result to new file, open it, copy table, paste it into master workbook, delete export file. Takes time and it is pretty annoying when you need to copy lots of small tables. Is there or can there be in future something to speed copy/paste to Excel up? Thanks.

    1. thatjeffsmith Post
      Author
      1. It rocks! I can even select only some columns and it works perfectly. I wish I would have not missed THAT post years ago. Thank you.

      2. thatjeffsmith Post
        Author
    1. thatjeffsmith Post
      Author

Leave a Reply

Your email address will not be published. Required fields are marked *