CommunityNews

CommunityNews

Hierarchical Structures in PostgreSQL (2020)

It’s a common pattern: a database developer at a startup is probably on the Product subteam of the Engineering team at their company. In a department store, shoes are a subcategory of clothing, while your favorite thermos is probably in the travel department.

In any Github organization, there are teams within teams within teams. In any large department store there are categories deeply nested. In any recipe book, there are many ways to classify food.

So how can we model them?

Jake (my boyfriend) and I have been exploring relational database concepts out of interest and pure geekery. This was a fun problem that I gave him and we got to work it out together. It was so fun we wanted to share! We won’t beat the bush around with PostgreSQL installation, security, setup, blah blah at this time, let’s just have some pure database fun for a few minutes!

Read in full here:

This thread was posted by one of our members via one of our news source trackers.

Most Liked

OvermindDL1

OvermindDL1

Is it just me or is their example output of SELECT * FROM teams WHERE path @ 'Product'; very wrong?

AstonJ

AstonJ

What’s the @ for? Don’t think I’ve ever used that in a query :confused:

OvermindDL1

OvermindDL1

It’s part of the ltree type in postgres, it allows you to make paths without needing recursive queries and other such annoyances. The path @ element matches when the element exists as any element anywhere within the path. :slight_smile:

Where Next?

Popular Backend topics Top

CommunityNews
A new study looks into the dematerialized office, where sensorial experiences such as touch, taste, smell, and sensations of hot or cold ...
New
First poster: bot
There is a long, difficult road from vague, pie-in-the-sky ideas about what would be cool to have in a new programming language, to a rob...
New
First poster: OvermindDL1
This comes up in my conversations surprisingly often so I thought it’s worth to write my thoughts down instead of repeating them again an...
New
CommunityNews
What is 3110 about? You might think this course is about OCaml. It’s not. You might think this course is about data structures. It’s not...
New
First poster: bot
A conversation with Laurent Mazare about how your choice of programming language interacts with the kind of work you do, and in particula...
New
First poster: mafinar
8 Reasons why Clojure is a better Java than Java. Clojure is better than Java at its own game. Using code examples, we dive into what ma...
New
First poster: bot
Ruby: How to Run a Rack app in a Background Thread. Stubbing and mocking are fine, but sometimes you want to test full integration. This...
New
First poster: OvermindDL1
GitHub - deadpixi/wasm-maze-generator: A simple WASM maze generator in Go. A simple WASM maze generator in Go. Contribute to deadpixi/wa...
New
CommunityNews
The other day I got a mail from Dean Galvin from Rowan University. Dean was doing an Erlang project so he asked “What example program wou...
New
First poster: faust
Ruffle is a Flash Player emulator written in Rust. Ruffle runs natively on all modern operating systems as a standalone application, and ...
New

Other popular topics Top

dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
PragmaticBookshelf
Build highly interactive applications without ever leaving Elixir, the way the experts do. Let LiveView take care of performance, scalabi...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New