SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2005
    Location
    New York, NY, U.S.
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Recommendations for a beginning/intermediate SQL book/site?

    I am currently reading PHP and MySQL for dynamic websites visual quickpro guide, however I find that this book doesn't cover very in depth and sometimes lacks good explainations of concepts, why the code is the way it is, what some things stand for, etc. I'm looking for a seperate book on SQL (i'm using MySQL) and a seperate book on PHP (I could post a request for this book info in the PHP forums), or a book that covers both very well. Specifically what confuses me in SQL are joins, and also some other SQL concepts, as well as I don't undertand database normalization as well as I wish. Can someone point me in the right direction for a book or link to a site that explains these very well? (examples help me out a lot). Thank you for your help.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,014
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    there are many good resources listed on my SQL Links page
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    260
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm currently reading Wrox - Beginning MySQL which is pretty good. I too started with learning PHP+MySQL books, but none of them discuss MySQL indepth. I think you're making an excellent decision to pause your PHP studies and build up your SQL knowledge with a book dedicated to just MySQL.

  4. #4
    SitePoint Zealot
    Join Date
    Dec 2005
    Location
    New York, NY, U.S.
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you champ and r937. The thing that confuses me more than anything are joins. I just can't seem to grasp them. I think I should have a fairly solid understanding of SQL before I start trying to create complicated database and PHP sites. SQL joins are the bane of me I think. I know this probably isn't the right place to be asking this, but how hard would it be to convert applications written in PHP to AJAX? Thanks for your help so far, please keep it coming.

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,014
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Mygly
    ...how hard would it be to convert applications written in PHP to AJAX?
    from moderately difficult to very difficult
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want a straight forward way to think of joins here are a couple of things to remember.

    Since we read left to right, use LEFT JOINS when you need them rather than RIGHT JOINS. they are the same thing, they just match the tables in a different order. the results would be no different.

    The words INNER and OUTER are optional. It is good to use them to remind yourself, or somone else reading your code down the road (likely you) plain and simple what type they are.

    You need an INNER join when you want to match records from both tables.
    You use an OUTER or LEFT OUTER join when you want to find unmatched records.

    An example of an OUTER would be when you want to find the test scores by your students in a class. If it is possible some of your students have not written the tests you would have no results for them but students would still exist. An outer join would let you find those students who have not written the test yet.

    One other thing, some folks use list join syntax, others use the ON clause. They are both the same, but the ON clause is much easier to refer back to later, especially complicated joins.

    For instance

    Code:
    select a, b, c, d
     from table1, table2
     where
     table1.a = table2.c
    Code:
    select a, b, c, d
      from table1
     inner join table2
      on
      table1.a = table2.c
    while the two look similar, it is easier to overlook a join condition in the top style, the latter is also easier to read when you have more tables added, and more conditions added.

    There is a basic tutorial in the mysql manual. the r937.com site also has many more involved examples.

    Also this forum, and others, always have people willing to help out. It is a great learning tool.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •