Home arrow SQL arrow Page 3 - Lies, Damn Lies, Statistics, and SQL
SQL

Lies, Damn Lies, Statistics, and SQL


sqlHeard about the Developer Shed December Giveaway?  Peter has a method useful for all things statistical.  In this article, Peter shows us how you can make use of some quick methods to generate statistics for your sites or projects in as little time as possible.  Using MS Access and a little SQL code, Peter is able to devise an algorithm useful for determining this month's winner.

Author Info:
By: Peter Lavin
Rating: 3 stars3 stars3 stars3 stars3 stars / 23
December 23, 2003
TABLE OF CONTENTS:
  1. · Lies, Damn Lies, Statistics, and SQL
  2. · Finding the Data
  3. · Capturing the Data
  4. · Into the Database
  5. · The Contest SQL
  6. · Conclusion

print this article
SEARCH DEVARTICLES

Lies, Damn Lies, Statistics, and SQL - Capturing the Data
(Page 3 of 6 )

Select all of the articles and related information on the PHP page, avoiding the table header, and copy them to the clipboard using menu options, or simply by simultaneously pressing “Control” and “c”. We’re going to use Access, so I’ll assume you are running Windows. Open WordPad – make sure you don’t use Notepad. Paste the contents of the clipboard into WordPad. Looks like quite a mess doesn’t it? I’ll bet you’re wondering how this can be any use to us – have faith and you’ll see shortly.

We are now going to save this file in text format so choose “Save As” from the “File” menu option. You should be presented with a file dialogue box. Choose “text document” as the file type and change the file name to “hits.txt”. Make sure you use the “.txt” extension. Access is picky about extensions when importing files and misbehaves if it doesn’t get its own way.

Before proceeding let’s have a look at the “hits.txt” file using Word. Right click the file name and open the “Send To” option. If you don’t find “MS Word“ you can add it by simply putting a shortcut in the “Send To” directory. If you don’t want to do this just open Word and open the file, making sure that you select the right file type from the “File Type” dropdown box.

It doesn’t look quite as funny as it did previously – in fact it looks rather commonplace. To understand what’s going on the formatting marks need to be displayed. This is done from the “Tools” menu, by clicking “Options”, and then the “View” tab. Under “Formatting marks”, check the “All” box. Now you should see the text separated by “arrows” and funny looking backward “P’s”. You’re looking at tabs and carriage returns. In order for Access to import a text file it needs to be able to tell where the columns and rows end. The tabs will separate columns and the carriage returns will separate rows.

Your first line of text should look like the following:

If it does then everything should probably work just fine. Make sure you don’t resave in Word format.


blog comments powered by Disqus
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

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials