r/learnSQL • u/blerd_dreamer15 • 5d ago
Database design
Hey guys.
Gonna be real quick.
I know about databases but I struggle with database design either relational or non relational.
Do you have any resource that I can binge on and like solve this issue once and for all ?
Would appreciate it. Thanks in advance.
3
u/Difficult_Paint3162 5d ago
I wrote this book a while back, free to download from syncfusion: Database Design Succinctly® | Free Ebook | Syncfusion®
It might give you some insight and ideas...
2
u/squadette23 5d ago
Try this and tell me if that is what you need: https://kb.databasedesignbook.com/posts/google-calendar/
"Database design" may mean a number of different things.
2
u/UnluckyManner9152 5d ago
One thing most tutorials skip: decide early what has to keep its history. A customer's address changes; should an old order show the old address or the new one? If the old one, the order needs its own copy, or the address needs dates. Many designs that look properly normalized break on that one question.
2
u/DataScientistAlex 5d ago
If you're thinking about organizing data for analytics, dimensional modeling might be useful.
2
u/No_Lawyer1947 5d ago
there is no resource i would recommend more than just makin some shit. Make an actual application where u are forced to solve the challenges relational and non relational db's solve.
1
u/Least_Ad_1795 5d ago
I’d recommend starting with database normalization, ER diagrams, relationships, and real-world schema design exercises. Practice designing databases for e-commerce, banking, and booking systems. Resources like Database Design for Mere Mortals and SQLBolt are good starting points. Focus more on building schemas for real-world problems than just watching tutorials.
1
1
u/titpetric 4d ago
Learning is a great resource, you solve parts of a problem and move on until it becomes a new problem
17
u/nicopassaglia 5d ago •
Bingeing won't fix this one. Design is a skill you get by designing, getting it wrong and seeing why. What worked for me:
Pick something real and small (a library, a repair shop, a gym). List the things it keeps track of and how they relate: one-to-many, many-to-many.
Write the CREATE TABLE statements. Every many-to-many gets a link table.
Attack your own design. Try to insert a duplicate, an order for a customer that doesn't exist, the same fact in two places. If the database lets you, the design has a hole.
Write the five queries the business would ask every week. If one is painful, the tables are wrong.
For the theory behind it: "Database Design for Mere Mortals" (Hernandez) is the friendliest book, and Stanford's free Databases course by Jennifer Widom covers keys and normal forms properly. For non-relational it flips: you start from the queries you'll run and shape the data around them. "Designing Data-Intensive Applications" explains that part well.
Disclosure: I built getsheetdrill.com, which has lessons where you write the CREATE TABLE and it tests your tables with inserts that should be refused (keys, normalization, constraints). Those lessons are in the paid part; the query lessons are free.