-
-
Save simonw/c16ce01244760e186a3a0aa3fee0405d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create the 'nodes' table in SQLite | |
CREATE TABLE nodes ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, | |
data TEXT | |
); | |
-- Create the 'edges' table in SQLite | |
CREATE TABLE edges ( | |
previous_node INTEGER REFERENCES nodes(id), | |
next_node INTEGER REFERENCES nodes(id), | |
PRIMARY KEY (previous_node, next_node) | |
); | |
-- Insert random data into the 'nodes' table in SQLite | |
WITH RECURSIVE | |
random_data(cnt, rnd) AS ( | |
SELECT 1, (abs(random()) % 1000000) || '_name' | |
UNION ALL | |
SELECT cnt+1, (abs(random()) % 1000000) || '_name' | |
FROM random_data | |
WHERE cnt < 1000000 | |
) | |
INSERT INTO nodes(data) | |
SELECT rnd FROM random_data; | |
-- Insert random data into the 'edges' table in SQLite | |
WITH RECURSIVE | |
random_edges(cnt, previous_node, next_node) AS ( | |
SELECT 1, abs(random()) % 1000000 + 1, abs(random()) % 1000000 + 1 | |
UNION ALL | |
SELECT cnt+1, abs(random()) % 1000000 + 1, abs(random()) % 1000000 + 1 | |
FROM random_edges | |
WHERE cnt < 1000000 | |
) | |
INSERT OR IGNORE INTO edges(previous_node, next_node) | |
SELECT previous_node, next_node FROM random_edges; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I created this by sending GPT-4 the following prompt:
Then following up with: