SQL
  Home arrow SQL arrow Page 4 - Lies, Damn Lies, Statistics, and SQL
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
SQL

Lies, Damn Lies, Statistics, and SQL
By: Peter Lavin
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 21
    2003-12-23

    Table of Contents:
  • Lies, Damn Lies, Statistics, and SQL
  • Finding the Data
  • Capturing the Data
  • Into the Database
  • The Contest SQL
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Lies, Damn Lies, Statistics, and SQL - Into the Database


    (Page 4 of 6 )

    We are now ready to convert our text file into a database table. Access is not an industrial-strength database, like Oracle or DB2, and for this reason it is sometimes maligned. However that may be, for the job we are about to do, I wouldn’t want any other database.

    Open Access and create a new database. I’ve called mine “objectivewinner.mdb”, but feel free to choose whatever name you like. If you already know how to import text files into a database you can skip this section and move on to the section entitled “More Data”.  For the others, here’s how it’s done.

    Using the “File” menu option choose “Get External data“ and “Import”.  Make sure you choose the “Text Files” file type and click on “hits.txt”. The “Import Text Wizard” opens and makes your job very easy. Choose the defaults until Access asks for a primary key. Choose “No primary Key”. Continue selecting the defaults through to the end.

    When Access has finished importing it will report that there were errors. For our purposes, these are not important, so just ignore them. You should now have a table in your database called “hits”. We’re going to clean it up in a minute but let’s import some more data first.

    More Data

    To ensure the objectivity of our exercise let’s randomly choose two other categories to import, namely the “Java” articles and the “MySQL” articles. (Be assured that the fact that the author of this article has published in both these categories has no bearing whatsoever.) Repeat the steps above to import these categories but make one exception; choose to import your data into the existing table “hits”.

    Clean up the Database

    Open the table “hits” in design view and delete “Field1” and “Field2”. These fields are not used, so nothing will be lost. Rename the remaining fields “Title”, Author” and “Hits” in that order. We’re now ready to query the database and very soon we’ll have the name of December’s winner.

    More SQL Articles
    More By Peter Lavin


     

    SQL ARTICLES

    - Focusing SQL Queries
    - Complex SQL Queries
    - A Close Look at the SQL Query
    - Generating Reports with SQL Date Handling
    - Creating SQL Reports Based on Date Criteria
    - SQL Date Handling and Data Trends
    - Date Handling
    - Introduction to SQL
    - Lies, Damn Lies, Statistics, and SQL







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek