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,200
    Thanks
    63
    Thanked 453 Times in 441 Posts
    Blog Entries
    7

    Default

    C/c++
    Adrian ~ facebook | gist/github

    ['66.215.156.37','208.75.149.97'] // ip,ip array!
    "Take that sticker *off* your hat; you look stupid" --Wil Wheaton

  2. #12
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    11,862
    Thanks
    235
    Thanked 660 Times in 648 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>| Deutsch | italiano | español | português | català | un peu de français | Ninasoma Kiswahili | 日本語の学生でした。| درست العربية

  3. #13
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,200
    Thanks
    63
    Thanked 453 Times in 441 Posts
    Blog Entries
    7

    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.
    Adrian ~ facebook | gist/github

    ['66.215.156.37','208.75.149.97'] // ip,ip array!
    "Take that sticker *off* your hat; you look stupid" --Wil Wheaton

  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,609
    Thanks
    73
    Thanked 81 Times in 79 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
  •