Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

MySQL Book and PHP vs Perl

by bluethundr (Pilgrim)
on Oct 08, 2009 at 17:31 UTC ( [id://800045]=perlquestion: print w/replies, xml ) Need Help??

bluethundr has asked for the wisdom of the Perl Monks concerning the following question:

Howdy monks! long time fan of you guys here!

Well I hope you don't mind me asking this non-programming question here, so here it goes.

I really want to start picking up MySQL. I was wondering if you could recommend a book that gets you up to speed on it and provides a good rounded education on the topic.

For a job I recently got I had to relatively quickly learn PHP. That actually seems to be going pretty well. My background in Perl is allowing me to pick it up rather quickly. I will be using PHP just sort of as a handy interface to MySQL.

But I do have a book on Programming the Perl DBI from O'Reilly. Once I get my MySQL chops up to par I want to start using Perl for accessing the DB because I a) know it much better than PHP and b) think that Perl is way more powerful than PHP.

To summarize:

What book is best to get a good rounded knowledge of MySQL? What book is best to get me up to speed in reasonably short time in PHP so that I can access MySQL with it?

And if you would like to weigh in on why PHP may be good for some cases and Perl for others, I'm all ears.

Thoughts? Thanks Monks!!!

Replies are listed 'Best First'.
Re: MySQL Book and PHP vs Perl
by Your Mother (Archbishop) on Oct 08, 2009 at 17:44 UTC

    Paul DuBois's books on the subject are widely considered excellent. I've even seen them called the best entry-level technical books on any tech topic. He discusses both Perl and PHP at length.

    Side stepping that. I like MySQL. I use MySQL and have for years. I would recommend if you're starting from scratch that you go with PostgreSQL instead. I would also recommend Perl over PHP but PHP is awfully convenient and well supported on budget hosts. If you just want to get going and do a little hacking: PHP. If you think you have a future in this stuff and plan to take it deeper: Perl (it's a superior jumping off place for *many* technical issues and even other languages). Also, it's easy, and natural at first, to write insecure code with databases in any language. Make sure to search for tutorials on security and SQL injection attacks.

    Have fun.

      Well said, and thank you! Well if you wouldn't mind answering another question... what book to get started in Postgress can you recommend over the others? Also, would you care to elaborate on why PosgreSQL over MySQL? The benefits I've heard for MySQL are small, fast, easy. What are the benefits of PosgreSQL? Thanks!

        For Postgres reading material, I'd suggest the Postgres docs themselves: They are through, and easy to find stuff in. (At least for me. I find the MySQL docs horrible.)

        Add to that some general database books if you have never worked with databases before. Sorry, I don't have any recommendations for those.

        As for benefits: It scales better to large datasets, it has a fuller selection of database features, and it operates very close to the official spec for SQL. (Where MySQL deviates fairly widely from it on occasion. Which can be nice on occasion, but it means you'd be learning bad habits in those cases.)

        If you just want to learn, and are really care about 'small, fast, easy', SQLite might also be worth a look. There isn't a smaller database out there, it's still very fast, and it's definitely the easiest to set up. But it has a very different audience. (Although it follows the SQL spec better than MySQL, and has some features MySQL is missing...)

        I've also found either of the above much easier to use and install with Perl than MySQL, but that seems to be a fairly local thing. (Although the DBD::Mysql docs have huge 'if it doesn't work' sections...)

        :) That reminds me of the story about the drunk crawling around one night under the street lamp. Passer-by asks, "What are you doing?"

        Drunk replies, "Looking for my car keys."

        "Oh, you lost them here?"

        "No. But this is the only place with enough light to look for them."

        Based on books (and maybe even documentation) alone, MySQL could be a better choice. I don't know any Postgres books to recommend. Someone will probably come to your rescue here though. There are quite a few monks who prefer the engine. The good news is, there's not really a wrong choice. You'll find plenty o'discussions here on the topic.

Re: MySQL Book and PHP vs Perl
by halfcountplus (Hermit) on Oct 08, 2009 at 18:38 UTC
    I've been using HTML::Mason to do embedded web work a la PHP for a while now and it rocks -- you might want to check that out.

    I've even written a tutorial, which will at least provide a simple picture, and there are links to more info (eg, the first edition of an O'Reilly book is now free on-line):

    Intro to Embedded Perl Using Mason

    The example demo in the tutorial is a small on-line site that uses an SQL database.

    Amazon uses perl instead of php.

    The only potential drawback is you need a server running apache mod_perl. But here's an example advantage: I have a web based chat that uses a separate, stand-alone server for some processing. The server is written in perl, so it and the embedded web page stuff can share the same module for functions like verification, etc. etc.

    Then you can forget php and dedicate your mind to perl :)
Re: MySQL Book and PHP vs Perl
by Joost (Canon) on Oct 08, 2009 at 21:02 UTC
    Perl vs PHP: Last I checked, DBI was just a better "low level" database interface than anything PHP has to offer, but that might have changed in the last 2 - 3 years. But most of the differences are in the ease of using safe and efficient constructs and unicode support (which is pretty good in DBD::mysql)

    In any case, learning DBI or whatever PHP database interface is fairly trivial once you've got your SQL/MySQL skills up to scratch. The interfacing language isn't really that important, as far as database programming is concerned.

Re: MySQL Book and PHP vs Perl
by planetscape (Chancellor) on Oct 08, 2009 at 20:59 UTC
Re: MySQL Book and PHP vs Perl
by mickep76 (Beadle) on Oct 09, 2009 at 11:16 UTC

    Well books is a thing of the past generation, Google has all you need.

    Best approach to learn is usually start a small project like make a web app. with a database backend. Then use Google to find good tutorials and then simply copy/paste until you have something that is similar to what you want. Usually you pick the basics very fast using this principle and it will also save you the cost of that book, you never read anyway.

    Regarding Perl vs. PHP it's a personal preference. I would recommend starting with Perl since once you get a hang of Perl, PHP will seem like a walk in the park.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://800045]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-14 23:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found