sql - How to insert data into mysql with order -
if insert sql without "order by", records in sql arranged insert time.
i have table: authorization( pin, code)
however, run insert authorization(pin, code) values ('12', 'abcd'). after insert few records, query data , find these records have no order.
how can insert data insert time order.
thank you
tables in sql have no inherent ordering. definition of language. want add autoincrement id column data:
create table authorization ( authorizationid int auto_increment primary key, pin . . . code . . . . . . );
then when insert as:
insert authorization(pin, code) . . .;
a new id generated automatically. id
remember insert order. way, might want timestamp column, if want remember exact time of insert well.
Comments
Post a Comment