Any advice for a mySQL newb?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jbrent95
    SBR MVP
    • 12-07-09
    • 1221

    #1
    Any advice for a mySQL newb?
    I've decided to take the time and put in the effort to learn some mySQL and mySQL Workbench basics. Co you have any advice as to how to get started, or can you recommend a tutorial or reference?

    I've started with a copy of Baseball Hacks and a beginning mySQL reference book, but I don't seem to be getting very far.
  • splash
    SBR Rookie
    • 05-25-09
    • 38

    #2
    What are you trying to do with it? I started learning about 6 months ago. I'm lucky in that I see real life practical applications of MSSQL at work, so that helps. The best way to learn is to build or get a hold of a database and practice pulling the data you need.
    Comment
    • jgilmartin
      SBR MVP
      • 03-31-09
      • 1119

      #3
      Originally posted by splash
      The best way to learn is to build or get a hold of a database and practice pulling the data you need.
      This. It is a little bit confusing at first, but what I did was first did the actual database creation (i.e. setting up the table and fields) using phpmyadmin. Then, I read and followed the tutorial at http://www.tizag.com/mysqlTutorial/ to learn how to connect to the database. From there I just looked up whatever I wanted to do in the Tizag tutorial.

      Two resources that helped a lot:
      http://www.pantz.org/software/mysql/mysqlcommands.html - Has some more advanced code examples
      http://csv2sql.evandavey.com/ - Converts a CSV file into SQL statements
      Comment
      • Optional
        Administrator
        • 06-10-10
        • 61376

        #4
        There are about 50 self paced free training courses here: scriptschool.com

        Got me started from zero knowledge to creating php/mysql database driven websites in no time.
        .
        Comment
        • Flight
          Restricted User
          • 01-28-09
          • 1979

          #5
          For loading CSV data into SQL, MySQL Workbench 5.2.25 supports the LOAD DATA INFILE command.

          Code:
          LOAD DATA LOCAL INFILE 'C:/Data/NFL2009_season.csv'
              INTO TABLE db.nfl2009season
              FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
              LINES TERMINATED BY '\n';
          The Baseball Hacks book should get you started coming up with ideas for queries. It is really limitless with what you can do, so start off by asking questions like "What do I want to see?" For instance, I want to see how the Seahawks fared against the spread in 2008, a single SQL query should give me that information. Now put some thought into what that query should be. Then you can tweak your parameters further, like how did the Seahawks do against the spread when the total was above 45?

          This is where having SQL queries available becomes really powerful - instant custom views into large data sets.
          Comment
          • Flight
            Restricted User
            • 01-28-09
            • 1979

            #6
            Another tip: Stay away from web-based stuff. Do everything local, at least for learning. You don't need php, phpmyadmin, html, etc. Keep it simple until you own a data set and know how to use it.
            Comment
            • jbrent95
              SBR MVP
              • 12-07-09
              • 1221

              #7
              Originally posted by Flight
              For loading CSV data into SQL, MySQL Workbench 5.2.25 supports the LOAD DATA INFILE command.

              Code:
              LOAD DATA LOCAL INFILE 'C:/Data/NFL2009_season.csv'
                  INTO TABLE db.nfl2009season
                  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
                  LINES TERMINATED BY '\n';
              The Baseball Hacks book should get you started coming up with ideas for queries. It is really limitless with what you can do, so start off by asking questions like "What do I want to see?" For instance, I want to see how the Seahawks fared against the spread in 2008, a single SQL query should give me that information. Now put some thought into what that query should be. Then you can tweak your parameters further, like how did the Seahawks do against the spread when the total was above 45?

              This is where having SQL queries available becomes really powerful - instant custom views into large data sets.

              The problem that I have with the Baseball Hacks guide is loading the bbdatabank.sql data. Everytime I try to load it from the command line, I get an access denied error. When I completely start over and try to load data file with Workbench, I get the tables but there is no data. I am assuming, that after going through a tutorial or 2, I will be able to get past this step.
              Comment
              • Flight
                Restricted User
                • 01-28-09
                • 1979

                #8
                Does Workbench issue an error? (other than stating 0 records inserted)

                Are you trying to load CSV data, or are you running a series of INSERT queries?

                If you are using CSV data, make sure your LOAD DATA query matches your csv format. The sample query I gave usually works. If there is a header line in the CSV data, don't forget to add "IGNORE 1 LINES" to the query.

                If you are still struggling, check the reference manual for LOAD DATA.
                Comment
                • splash
                  SBR Rookie
                  • 05-25-09
                  • 38

                  #9
                  Originally posted by Flight
                  Another tip: Stay away from web-based stuff. Do everything local, at least for learning. You don't need php, phpmyadmin, html, etc. Keep it simple until you own a data set and know how to use it.
                  I've been using phpmyadmin. Is workbench better? I do find phpmyadmin annoying to use. I'm used to MS SQL Server Management Studio at work. Is there a better gui for mysql?
                  Comment
                  • roasthawg
                    SBR MVP
                    • 11-09-07
                    • 2990

                    #10
                    Setup xampp on your computer.
                    Comment
                    • gohabsgo
                      SBR MVP
                      • 03-19-10
                      • 1903

                      #11
                      This site is the best for the basic stuff

                      W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
                      Comment
                      • Flight
                        Restricted User
                        • 01-28-09
                        • 1979

                        #12
                        Originally posted by splash
                        I've been using phpmyadmin. Is workbench better? I do find phpmyadmin annoying to use. I'm used to MS SQL Server Management Studio at work. Is there a better gui for mysql?
                        MS SQL Studio is fine. So is MySQL Workbench.

                        My point was to simplify the learning curve and get to the stuff that matters - the data. Don't get slugged down in learning a new language like PHP. phpmyadmin is nice for remote administration. For the newb in this thread, just stick to your local PC.

                        Originally posted by roasthawg
                        Setup xampp on your computer.
                        Xampp is a great toolset and I recommend it - but again, not for newbs. Too much learning curve, too many tools, too many new languages. Go ahead and set it up since it's free and easy... but stick to the data! (I often find myself wasting time with tools and computer tasks when I should be focusing on sports data.)
                        Comment
                        • Maverick22
                          SBR Wise Guy
                          • 04-10-10
                          • 807

                          #13
                          Your best bet is to find an "SQL CookBook". Yea i know it sounds crazy.

                          But what a book like this will do is detail "situations" and then show you how to solve them using a given language ( in this case, mysql)

                          For example it might say... "How to determine what fields are present in table 1, but not in table 2","How To List All The Fields Sorted in descended order by last name", and so forth. I would check amazon, and look for a random page preview for something that does this...

                          This will be alot easier than sitting down to a "mysql for beginners book"
                          Comment
                          • arwar
                            SBR High Roller
                            • 07-09-09
                            • 208

                            #14
                            mySQL and PHP go hand in hand and both are open source (free) you can also install an Apache webserver (or IIS if you are m$oft type) all on your PC so your query results, etc. can be displayed in browser. i have whole library of mySQL & PHP .pdf books. if anyone is interested then PM
                            Comment
                            • uva3021
                              SBR Wise Guy
                              • 03-01-07
                              • 537

                              #15
                              Download XAMPP

                              Download XAMPP for free. An easy to install Apache distribution containing MySQL, PHP, and Perl. XAMPP is a very easy to install Apache Distribution for Linux, Solaris, Windows, and Mac OS X. The package includes the Apache web server, MySQL, PHP, Perl, a FTP server and phpMyAdmin.


                              And I'd learn PHP, and you can use that to control your SQL database
                              Comment
                              • jbrent95
                                SBR MVP
                                • 12-07-09
                                • 1221

                                #16
                                I finally figured out the proper procedure and syntax to load the bbdatabank database from the windows command prompt. I was never able to load it with MySQL Workbench. My next task will be to create a database from the Retrosheets play-by-play data.
                                Comment
                                • Miz
                                  SBR Wise Guy
                                  • 08-30-09
                                  • 695

                                  #17
                                  I have a very useful set of literature on this topic. You can PM me and I will email it to you.

                                  I worked through the example below and it really helped me begin to understand how to create and access tables in an efficient manner.

                                  I find that maximizing efficiency is just as important as knowing how to execute them in the command prompt.

                                  HMD29 adalah pusat dan platform situs game slot online terbaik dengan perkalian x1000 populer yang sudah banyak dinikmati oleh kalangan para pecinta game slot online di Asia. Dengan menghadirkan berbagai pilihan permainan dari provider ternama, HMD29 menjamin pengalaman bermain yang seru, adil, dan penuh keuntungan.
                                  Comment
                                  SBR Contests
                                  Collapse
                                  Top-Rated US Sportsbooks
                                  Collapse
                                  Working...