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

First poster: bot
nim-lang/Nim. Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages lik...
New
First poster: bot
As I continue to work on Cyberscore, I keep finding new quirks / features in PHP and MySQL. All of the tests below are being run on mysql...
New
CommunityNews
GitHub - mthom/scryer-prolog: A modern Prolog implementation written mostly in Rust… A modern Prolog implementation written mostly in Ru...
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
CommunityNews
Multicore OCaml by kayceesrk · Pull Request #10831 · ocaml/ocaml. This PR adds support for shared-memory parallelism through domains and...
New
First poster: bot
TLDR; the future of ML is Julia. If you are looking for a quick answer, there you have it. If you want the well reasoned explanation, sti...
New
First poster: bot
Building a Neural Network in Pure Lisp without Built-in Numbers using only Atoms and Lists. A neural network written in pure Lisp withou...
New
First poster: adamaiken89
PHP: Frankenstein arrays. PHP has become quite a nice language, but there are some ugly legacies left from the past. Like the deceptive ...
New
First poster: bot
Perfecting WebGPU/Dawn native graphics for Zig. A 700+ commit complete rewrite of mach/gpu (the WebGPU interface for Zig) has been compl...
New
First poster: bot
crubit/design.md at main · google/crubit. Contribute to google/crubit development by creating an account on GitHub.
New

Other popular topics Top

Exadra37
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
New
AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New