Advanced Search

Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: mysql shorthand

  1. #11
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,623
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    C/c++
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  2. #12
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    So it's a difference of the PHP and C, rather than the MySQL code itself? That makes sense. But I do wonder, just relative to the MySQL part (eg, the actual searching in the query), whether they run at the same speed. The PHP loop, for example, probably is slower than a C loop, but if MySQL via PHP is slower than MySQL via C, that's worth knowing.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #13
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,623
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    the loop that constructs the query would be faster, yes - the execution of the statement would be the same. MySQL is MySQL. Of course, the actual savings probably wouldn't be noticeable unless you had a _lot_ of traffic. and most web hosts don't give you enough access to write stored procedures unless you have a private server anyway.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  4. The Following User Says Thank You to traq For This Useful Post:

    djr33 (01-10-2012)

  5. #14
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,681
    Thanks
    78
    Thanked 89 Times in 87 Posts

    Default

    Code:
    SELECT * FROM table WHERE col != 'this' AND col != 'that'
    can be simplified as:
    Code:
    SELECT * FROM table WHERE col NOT IN ('this','that')
    Conversely:
    Code:
    SELECT * FROM table WHERE col = 'this' OR col = 'that'
    can be simplified as:
    Code:
    SELECT * FROM table WHERE col IN ('this','that')
    These were the only two shorthand functions I could find. ref
    To choose the lesser of two evils is still to choose evil. My personal site

  6. The Following 2 Users Say Thank You to james438 For This Useful Post:

    djr33 (03-27-2012),traq (03-27-2012)

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
  •