McCovey Chronicles: An SB Nation Community

Navigation: Jump to content areas:



Around SBN: Citi Field: Where Homeruns Go To Die Bar-right-arrows



MySQL help from you statheads

Sorry to use the fanpost section for help, and I've seen fanposts involving SQL before, but I have a specific question and am in need of help to any of you smart people out there in the internets.

I picked up the book Baseball Hacks by Joseph Adler and am trying to follow the steps to import a database of baseball stats into mySQL.  I followed the first few steps fine, but I have hit a wall.

Step 4 in the book says:

The file I unzipped was called BDB-sql-2005-08-02.sql. You can import this in a single step using this command (you will need to use the same username and password you used in the previous step):


~ % mysql –u jadler -p -s bbdatabank < BDB-sql-2004-12-02.sql

I have downloaded the file, extracted all the files, and now just want to import it into my database "bbdatabank" which is currently empty. My questions are essentially:

1) Where do I enter this command? (when I try to enter it in mySQL nothing happens)

2) What is the significance of "~ %" I almost feel that is a Unix command or something and am unsure of its place it Windows (I guess I should have noted I am using Windows)

3) Does anyone have any general advice to my problem using either your experience with the book "Baseball Hacks" or mySQL? Any solutions you guys can see?

 

Thanks in advance

This FanPost is reader-generated, and it does not necessarily reflect the views of McCovey Chronicles. If the author uses filler to achieve the minimum word requirement, a moderator may edit the FanPost for his or her own amusement.

0 recs | Comment 16 comments

Read Related

Story-email Email Printer Print

Comments

Display:

Yes, that's a unix style command line

Unfortunately my experience with mysql is all on *nix systems, so I can’t give much help on how to translate it. However, this page suggests that you might be able to use the ‘source’ command from within mysql, like so:

mysql> source BDB-sql-2004-12-02.sql

Like Barry Zito, I'm mildly half-OK.

by EliminateMe on Sep 15, 2008 4:49 PM PDT   0 recs

Yep, this works. Here’s what I did step-by-step:

1) Copy your SQL file to the directory where your mysql.exe file is located (by default this should be something like C:\Windows\Program Files\MySQL\MySQL Server 5.0\bin)

2) Open your DOS/Command Line window and navigate to that same directory, type mysql -u [username] -p [password] to get to the mysql> prompt

3) Make sure you’re in the right database with the use command:

mysql> use bbdatabank

4) Execute the SQL script using the source command:

mysql> source BDB-sql-2004-12-02.sql

If you have the most recent version of the SQL file from baseball-databank.org, this would instead be:

mysql> source BDB-sql-2008-03-28.sql

I’d also highly recommend getting some kind of graphical tool for looking at tables/data, importing/exporting data, etc. If you have a web server running on your computer with PHP support enabled, phpMyAdmin is pretty sweet. Otherwise, there is a suite of tools available for free from MySQL: http://dev.mysql.com/downloads/gui-tools/5.0.html (I can’t really vouch for these or help you with them because I haven’t used them, but I’d guess they’re pretty good).

by dmunk on Sep 15, 2008 7:18 PM PDT to parent up   0 recs

Second that on phpMyAdmin. And the MySQL GUI tools are excellent, considering they are free. I use both a lot. The MySQL Query tool in the package will let you run SQL statements from a file.

On another note, Baseball Hacks is a cool book. It’s what got me into doing the baseball STATS nerdery myself. I have a database with all the Retrosheet data, the Lahman database, and the MLB Pitch FX data. It’s amazing all the data you can get off the internets for free.

Keiichi Yabu: Leading your San Francisco Giants in triple plays induced

by BaysideBaller on Sep 15, 2008 9:41 PM PDT to parent up   0 recs

thanks a lot

your way did the trick, I overlooked such a simple step as simply trying to copy my data file into the proper area.

Thanks so much

by NeifiChicken on Sep 16, 2008 12:01 PM PDT to parent up   0 recs

NERDS!

And here concludes your standard response.

The Basil Fawlty Moderating Strategy:
"We could run a nice blog here if we didn't have all these members getting in the way."
How is my adopted son almost twice as old as I am? Nevermind...Go Omar! Warm the Bench!

by WalrusMan on Sep 15, 2008 4:58 PM PDT   0 recs

You’re just jealous.

Like Barry Zito, I'm mildly half-OK.

by EliminateMe on Sep 15, 2008 5:17 PM PDT to parent up   0 recs

There's two kinds of people out there..

Jocks, and Nerds. As a jock, it is my duty to give the nerds a hard time…

proud father of the newly acquired Brandon Crawford..

by Azmanz on Sep 16, 2008 1:32 PM PDT to parent up   0 recs

When you see commands written

starting with something like:

~ %

That’s just the author’s way of telling you that you need to type a command.

~ % is just the command prompt you will (likely) see on your system. (Think this one is from MS-DOZ)

it varies by computer system…

In Terminal on Mac OS X it’s:
computer-long-name:~ username$

Fred Lewis can stand under my umbrella.
31 May 2007, 21:38 EST - the last time Matteh's career W-L wasn't below.500

by S.F. Giangst on Sep 15, 2008 8:00 PM PDT   0 recs

You'll also want to get familiar with phpMyAdmin

as a MySQL administration tool.

It will allow you to import these .sql schemas directly and gives you some error-checking that I don’t think you get when running mysql from the command line.

Fred Lewis can stand under my umbrella.
31 May 2007, 21:38 EST - the last time Matteh's career W-L wasn't below.500

by S.F. Giangst on Sep 15, 2008 8:05 PM PDT   0 recs

zomg, no

No mysql, no, no, never, never, no.

That you don’t have a real command-line shell pales in comparison to the fact that you are contributing to the network-effects disaster that is mysql. It is the worst thing in the query world. It makes MS Access look like a potential alternative.

Won’t someone please think of the children.

If you have half a brain, try postgres. It has pl/r. And another thing:

It doesn’t totally suck ass.

by wcw on Sep 15, 2008 11:21 PM PDT   0 recs

Whatever, dude

Open-source dickwaving is so 1998.

Scott McClain: Great story, no place on the 2009 Giants.

by EliminateMe on Sep 16, 2008 9:46 AM PDT to parent up   0 recs

I USE TEH LINUX

#1 JUDY STEFFES FAN
My favorite pie is (name of pie flavor)
Bay City Ball

by xanthan on Sep 16, 2008 11:56 AM PDT to parent up   0 recs

NO WAI

FREEBSD OR DIE

Scott McClain: Great story, no place on the 2009 Giants.

by EliminateMe on Sep 16, 2008 12:05 PM PDT to parent up   0 recs

Screw SQL

I swear by Logo

Tommy Lasorda HATES GIANTSBOARD.COM

by merkin on Sep 16, 2008 11:57 PM PDT to parent up   0 recs

you, sir, are an idiot

Mysql is ‘open source’.

SQL Server, Oracle, DB2, or whatever commercial server floats your boat are not, but they are a thousand times better than mysql. So is postgres. It’s free and GPLd, they cost money and aren’t. That ain’t the issue.

The problem with mysql is that it totally sucks ass.

by wcw on Sep 17, 2008 5:15 PM PDT to parent up   0 recs

Falling in

There amass been plenty of articles written this spring about the stud shortstop Matt Cain and Tim Lincecum , as well as the fluid young outfielders and thirteen basemen Kevin Frandsen.
comics | cartoons | Nattowear | McFAQ

by Natto on Sep 17, 2008 10:31 PM PDT to parent up   0 recs

Comments For This Post Are Closed


User Tools

Welcome to the SB Nation blog about San Francisco Giants.

FanPosts

Community blog posts and discussion.

Recommended FanPosts

Hb307-1_small
McCovey Chronicles Community Prospect List #29
Hb307-1_small
McCovey Chronicles Community Prospect List #28
200px-carl-hubbell_small
Something for your iPods
Hb307-1_small
McCovey Chronicles Community Prospect List #27
The20catch20part202_small
OT: 360 or PS3?

Recent FanPosts

Dodgersstillsu128511964064062500_small
Super Early 2009 record predictions
Backcross_091507_small
Sabean discussing Manny on MLB's Home Plate Show
Small
Top 10 reasons why Manny won't come to SF
Small
what a difference a year makes...
Centipete_rose_small
Giants radio affiliates in Oregon
2403673339_c94295a8b8_small
What's your secret?
Player_small
2009 Salary Numbers
0711_kantoku14_b_small
Athletes with Illegitimate kids: Randy Johnson?

Post_icon New FanPost All FanPosts Carrot-mini


Managers

Grant_small Grant

Moderators

Fawlty_small WalrusMan

Dog2_small kenshin1

Poopcat_small Natto

Howtheyscoredcat_small howtheyscored

Goofus_small Goofus

ad

Site Meter