Back (Current repo: scraps)

random scraps and notes that are useful to me
To clone this repository:
git clone https://git.viktor1993.net/scraps.git
Log | Download | Files | Refs

insert_range_of_integers.sql (364B)


INSERT INTO some_table
SELECT @ROW := @ROW + 1 AS ROW, 'whatever', NOW(), NOW()
FROM some_big_table t
    JOIN (SELECT @ROW := 1000) t2
LIMIT 100;
--insert values 1000 to 1100. As long as some_big_table has at least that many rows, this method will work.

-- Assume some_table has columns id INT, name VARCHAR(100), stamp_created DATETIME, stamp_modified DATETIME