Unsupported Screen Size: The viewport size is too small for the theme to render properly.

How To Set The Order Of The Rows

forums › forums › SQLyog › Using SQLyog › How To Set The Order Of The Rows

  • This topic is empty.
Viewing 2 reply threads
  • Author
    Posts
    • #32456
      ashwin
      Member

      Hi,

      Quote:
      I couldn't keep the rows in the order of the 'id' number I entered. Whenever I refresh the table, then the rows changed their order.

      The row ordering is done by the server not by SQLyog. This is because the “Auto-increment” is enabled on the column('id' in your case). So MySQL assigns sequence numbers automatically.

      Quote:
      But I couldn't find a way to set up the 'id' number I want SQLyog to generate.

      To start with an AUTO_INCREMENT value other than 1, you can set that value with CREATE TABLE or ALTER TABLE, like this:

      ALTER TABLE tbl AUTO_INCREMENT = 100;

      Refer: http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html

      Thanks,

      Ashwin A

    • #32457
      jude
      Member

      Hi Ashwin,

      Thank you very much for your reply. That makes me understand this problem more.

      Now, when I create a new row, the automatically generated 'id' is 10000. But I want the automatically generated 'id' is 9800, rather than 10000, how can I do that? Btw, Can I disable this “Auto-increment”?

      Thanks.

      Huang

      'ashwin' wrote:

      Hi,

      The row ordering is done by the server not by SQLyog. This is because the “Auto-increment” is enabled on the column('id' in your case). So MySQL assigns sequence numbers automatically.

      To start with an AUTO_INCREMENT value other than 1, you can set that value with CREATE TABLE or ALTER TABLE, like this:

      ALTER TABLE tbl AUTO_INCREMENT = 100;

      Refer: http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html

      Thanks,

      Ashwin A

    • #32458
      ashwin
      Member

      Hi Huang,

      Quote:
      Now, when I create a new row, the automatically generated 'id' is 10000. But I want the automatically generated 'id' is 9800, rather than 10000,

      You can set the 'id' as 9800 by executing query:

      ALTER TABLE tbl AUTO_INCREMENT = 9800;

      But if there is a row already present in the table with 'id' 9800 then you cannot create with the same 'id' as it becomes 'duplicate row'.

      Quote:
      Can I disable this “Auto-increment”?

      Right-click on the table->Alter Table(F6)->Disable “Auto Incr?” (Refer attached image)

Viewing 2 reply threads
  • You must be logged in to reply to this topic.