WELCOME, GUEST
Minimize
Blogger List

Steven Feuerstein Indicates Oracle ACE director status
PL/SQL Obsession

Guy Harrison Indicates Oracle ACE status
Database topics

Bert Scalzo Indicates Oracle ACE status
Toad for Oracle, Data Modeling, Benchmarking
Dan Hotka Indicates Oracle ACE director status
SQL Tuning & PL/SQL Tips

Valentin Baev
It's all about Toad

Ben Boise
Toad SC Discussions

Dan Clamage
SQL and PL/SQL

Kevin Dalton
Benchmark Factory

Peter Evans 
Business Intelligence, Data Integration, Cloud and Big Data

Vaclav Frolik  
Toad Data Modeler, Toad Extension for Eclipse

Devin Gallagher
Toad SC discussions

Anju Gandhi
Toad for Oracle

Stuart Hodgins
JProbe Discussions

Julie Hyman
Toad for Data Analysts

  Henrik "Mauritz" Johnson
Toad Tips & Tricks on the "other" Toads
  Mark Kurtz
Toad SC discussions
Daniel Norwood
Tips & Tricks on Toad Solutions
Amit Parikh
Toad for Oracle, Benchmark Factory,Quest Backup Reporter
Debbie Peabody
Toad Data Point
Gary Piper
Toad Reports Manager
John Pocknell
Toad Solutions
Jeff Podlasek
Toad for DB2
Kuljit Sangha
Toad SC discussions
Michael Sass 
Toad for DB2
Brad Wulf
Toad SC discussions
Richard To
SQL Optimization
  Toad Data Modeler Opens in a new window
Data Modeling
 
  Toad Higher Education
How Hi-Ed Uses Toad
  Real Automated Code Testing for Oracle
Quest Code Tester blog
  中文技术资料库
技术文章
 

Blogs

Toad World blogs are a mix of insightful how-tos from Quest experts as well as their commentary on experiences with new database technologies.  Have some views of your own to share?  Post your comments!  Note:  Comments are restricted to registered Toad World users.

Do you have a topic that you'd like discussed?  We'd love to hear from you.  Send us your idea for a blog topic.


May 17

Written by: Jeff Smith
5/17/2010  RssIcon

What’s the first thing we learn when it comes to databases and/or SQL? Odds are it was how to write a SQL statement to retrieve data from one or more tables.


Image courtesy of Bart Simpson Chalkboard Generator

The merits and detriments of using the SELECT * command have been, and will continue to be, debated all over the Internet. Here are a few enlightening and entertaining takes:

Yes, these are all SQL Server folks; please don’t hold it against them. To be honest though, this topic concerns ALL database professionals.

I don’t want to re-open this can of warms as others have waxed philosophical much more eloquently than I. However, most schools of thought come down to the following Pros & Cons:

PROS
  • Easy
  • Gets me all columns w/o hard-coding column names
CONS
  • Easy
  • You ask for everything, but only need a subset
  • Expensive
  • If the column order, column names, or column definitions change, your query (and Application!) is bound to break
Toad Can Help!

You are going to write SELECT * queries no matter what I or anyone else tells you. However, if you want, you can get help. Let’s investigate some methods in Toad:

Code Insight

If you want all of the columns for one or more tables, Toad can get you these very quickly, and with no typing. You can optionally use F4 DESC popups and the Object Palette to drag-and-drop column names into your queries.

Schema Browser

While in the Browser, you can quickly ask Toad to build your SELECT statement for you.


Mouse-click, Voila!

By the way, Toad does drink it’s own Kool-Aid! When you click on the Data Tab for a table or view in the Schema Browser, it explicitly lists the columns to be displayed.

A Parting Gift for our SQL Server Friends

Toad for SQL Server (as well as Toad for Data Analysts) will support you regardless of your take on the SELECT * debate.

The Editor has the same IntelliSense features that Toad for Oracle offers – and oh by the way, we support this feature while connected to SQL 2000 and 2005 in addition to 2008. Amazing that some IDE’s only offer this feature if you are using SQL Server 2008…but that’s another blog!

If you decide to use our Query Builder, you have your choice in going for all columns in an object:

One last thing, don’t chuckle at the Query Builder. When surveying about 800 customers a few years ago, we found this to be the most popular feature in Toad when it comes to productivity. Apparently not everyone enjoys manually typing out JOINS as much as you do.

And of course, to come back full circle, when getting started with SQL or databases, someone will want help in building their queries. And if they stumble upon the Query Builder, thankfully we do list the ‘Add All Columns’ selection first!

 
P.S. Twitter Is Not Just About Telling People What You Had for Lunch

I came across this SELECT * debate there just the other day and learned quite a bit from my fellow database professionals. I generally follow more SQL Server folks as that’s where I need the most help…if you’re curious but too afraid to try it out, I heartily recommend this tutorial.

 
 

Search Blog Entries
 
Blog Archives
 
Archive
<May 2013>
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
Monthly
May, 2013 (15)
April, 2013 (13)
March, 2013 (10)
February, 2013 (5)
January, 2013 (7)
December, 2012 (6)
November, 2012 (10)
October, 2012 (8)
September, 2012 (6)
August, 2012 (8)
July, 2012 (8)
June, 2012 (12)
May, 2012 (21)
April, 2012 (10)
March, 2012 (16)
February, 2012 (19)
January, 2012 (20)
December, 2011 (19)
November, 2011 (14)
October, 2011 (12)
September, 2011 (17)
August, 2011 (15)
July, 2011 (16)
June, 2011 (13)
May, 2011 (15)
April, 2011 (8)
March, 2011 (21)
February, 2011 (17)
January, 2011 (16)
December, 2010 (13)
November, 2010 (13)
October, 2010 (7)
September, 2010 (15)
August, 2010 (11)
July, 2010 (13)
June, 2010 (12)
May, 2010 (14)
April, 2010 (12)
March, 2010 (13)
February, 2010 (12)
January, 2010 (7)
December, 2009 (10)
November, 2009 (12)
October, 2009 (15)
September, 2009 (18)
August, 2009 (13)
July, 2009 (23)
June, 2009 (14)
May, 2009 (17)
April, 2009 (7)
March, 2009 (14)
February, 2009 (7)
January, 2009 (12)
December, 2008 (7)
November, 2008 (11)
October, 2008 (19)
September, 2008 (14)
August, 2008 (11)
July, 2008 (14)
June, 2008 (19)
May, 2008 (12)
April, 2008 (18)
March, 2008 (13)
February, 2008 (8)
January, 2008 (7)
December, 2007 (5)
November, 2007 (8)
October, 2007 (13)
September, 2007 (13)
August, 2007 (16)
July, 2007 (11)
June, 2007 (6)
May, 2007 (5)
April, 2007 (5)
March, 2007 (8)
February, 2007 (6)
January, 2007 (6)
December, 2006 (5)
November, 2006 (8)
October, 2006 (4)
August, 2006 (3)