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

New
New
First poster: bot
Kawa is a general-purpose programming language that runs on the Java platform. It aims to combine: the benefits of dynamic scripting la...
New
First poster: OvermindDL1
What we can learn from “_why” the long lost open source developer… Code might not last forever, but _why proves you can have an impact t...
New
CommunityNews
This repository contains a collection of sample applications and libraries written in Zig programming language and using DirectX 12 API. ...
New
First poster: bot
Lisp Interview: questions to Alex Nygren of Kina Knowledge, using Common Lisp extensively in their document processing stack - Lisp jour...
New
First poster: bot
GitHub - cshum/imagor: Fast, Docker-ready image processing server written in Go and libvips, with Thumbor URL syntax. Fast, Docker-ready...
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: bot
50 Years of Prolog and Beyond. Both logic programming in general, and Prolog in particular, have a long and fascinating history, interm...
New
First poster: bot
Haskell in Production: Freckle. In this interview, we talk with Pat Brisbin, a Principal Engineer at Freckle, a company that helps teach...
New

Other popular topics Top

AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New