3 ms·
I love the design and examples in this post. Easy to read for sure. Exercises like this also seem fun in general. It's a real test of how much you know to star
by skeptrune 1y ago
I love the design and examples in this post. Easy to read for sure.
Exercises like this also seem fun in general. It's a real test of how much you know to start anything from scratch.
- kevinqi 1y agomy only minor critique is using lorem ipsum examples. It tends to make me want to gloss over instead of reading; I prefer seeing realistic data. other than that, it's a really cool post
- WD-42 1y agoWas going to post the same thing. Lorem Ipsum makes the data too hard to distinguish. I get that due to the dynamic nature of the examples the text needed to be generated, but Latin isn't the best choice IMO. Otherwise great article, thank you!
- doublerabbit 1y agoIt's the same for me when foo and bar are used as examples.
- samwho 1y agoSomeone gave me the advice to use animals, ideally animals of very different sizes or colours. People instantly picture them and remember them.
- kragen 1y agoYou may be interested in http://canonical.org/~kragen/sw/dev3/exampledb.py http://canonical.org/~kragen/sw/dev3/exampledb.py -sql -n 2 example.sql: begin; insert into cust (id, name, company, streetaddress, city, state, zip) values (1, 'Jacqueline Gagnon', 'Baker Group', '218 Miller Dr.', 'Riverside', 'KS', '51859'); commit; begin; insert into cust (id, name, company, streetaddress, city, state, zip) values (2, 'Wayne Bennett', 'FF Petroleum LLC', '4375 Moore Dr.', 'Mount Vernon', 'MS', '98270'); select setval('cust_id_seq', 2); commit; begin; insert into product (id, name, unitprice) values (1, 'Biological blue steel doll', 30.4); commit; begin; insert into product (id, name, unitprice) values (2, 'Gray cotton electronic boxers, size L', 13.3); insert into product (id, name, unitprice) values (3, 'Blue cotton intimate blazer, ages 2–5', 37.3); insert into product (id, name, unitprice) values (4, 'Daily beige steel car', 14.6); insert into product (id, name, unitprice) values (5, 'Black spandex daily blazer, size L', 24.1); insert into product (id, name, unitprice) values (6, 'Blue wool dynamic briefs, ages 3–10', 79.0); insert into product (id, name, unitprice) values (7, 'Blue spandex ultrasonic dress, child’s size', 31.9); insert into product (id, name, unitprice) values (8, 'Gold wool daily boxers, ages 3–10', 8.85); insert into product (id, name, unitprice) values (9, 'Red cotton utility boxers, ages 2–5', 28.9); insert into product (id, name, unitprice) values (10, 'Gray polyester ultrasonic briefs, ages 3–10', 15.3); -- ... It also creates the tables, including invoice and lineitem tables. It's still a bit of a dull accounting example, rather than something like food, superheroes, social networks, zoo animals, sports, or dating, but I think the randomness does add a little bit of humor. Although now we have LLMs, and maybe they'd do a better job.
- ashleyn 1y agoI was tempted to knee-jerk dismiss this as "don't write your own database, don't even use a KV database, just use SQL". And then I remembered the only reason I'd say this is because I went through designing my own DB or using KV databases just to avoid SQL...only to realise i was badly reinventing SQL. It could be worth the lesson.
- shellfishgene 1y agoIt's very nice, but I think he should expand on why hash tables are fast/constant time lookup. It's a central concept to why the index makes the db fast.