a database accessed by SQL has no concept of "first one" or "next one". Whichever record is returned "first" (or "next") is not strictly defined.

While the second statement is accurate, the first is not. At least, not without context.

Technically, there most definitely is an order, as the data is stored in files, and those records do not usually move. And when they do move, there is an identifier in place saying so, until a specific operation removes it.

So, though not strictly defined, there is definitely a first record, and that is why it is always returned first in a vanilla statement. However, it cannot be relied upon because it can change from an outside statement affecting storage, or even a recent caching that included an order by (or a group by, which does its job via a binary sort.)

If you'd like to be technically correct, you would drop the words "a database accessed by" and use the KISS* method, "there is nor first or last in SQL, without an explicit ORDER BY clause."

--

*Keep It SQL, Stupid


In reply to Re^2: Increase a value inside MySQL query using perl by chacham
in thread Increase a value inside MySQL query using perl by AhmedABdo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.