MySQL插入表的末尾

I am having a problem with inserting a new item at the end of my MySQL table. When I insert the new item it appears after the last created item, but I want it to be entered at the bottom of the table. Suppose that I have a table id = int,Primary Key and album=string and the table is:

  1. Wrath
  2. Crack The Skye
  3. Enter Shikari

What would the MySQL query be if PHP variable $album=myAlbum was to be inserted next, at the end of the table, and with the appropriate id?

You have to understand what a database is.

There is no "end" in the database. The rows take order only at the SELECT time.

So, you have to add an ORDER BY clause to your SELECT query to make rows in the desired order.

You may add another field to order your table by or use an existing one.

I am confused - the order in the table does not matter. If you need a specific ordering, then query the data using an ORDER BY clause.

You want the id column to be auto_increment. This will give the behaviour you're looking for.

You should define the id with autoincrement so that MySQL will keep a counter that grows on each insert. That way you can order by id to know in which order stuff went in.

have your id autoincremented, and then in the insert query don't precise the id .

with precising:

INSERT INTO markers_greenZones(id, name, info, lat, lng, radius, markertype, time) VALUES (1,'zone beta','this is info',-53.861034,100.171935,50000,'HighRisk','2017-25-2 10:15:12')

witout precising:

INSERT INTO markers_greenZones (name, info, lat, lng, radius,markertype,time) VALUES ('zone alpha', 'you should be calm, stay together, respect each other, work together, and follow our instruction', 55.861034, 100.171936, 50000,'HighRisk','2017-25-2 10:15:12');

the incremental will be done automatically and your raw following the id (primary key) will be added to the end.