top | item 35140048

(no title)

ccouzens | 3 years ago

There are other ways, like having a null with more regular semantics and better composeability (like Rust's option type).

Or imagine this data:

Students:

Name: Bob

Name: Alice

StudentsClasses

Student: Bob, class: cryptography.

Student: Bob, class: databases

If you can have arrays (or relations) as a field in your result set, then

Students left outer join StudentsClasses

Could return

Student: Bob, classes: [ cryptography, databases]

Student: Alice, classes: []

discuss

order

goto11|3 years ago

This violates first normal form. So if you want to query this result further you need a more complex language than relational algebra because you need to be able to query nested structures.

emmelaich|3 years ago

1nf is surprisingly tricky to define.

If you consider it as a single atomic list then it is still in 1nf.

It's only not in 1nf with respect to future queries IF you want to subselect from within the list values.

ccouzens|3 years ago

The normal forms are about how data is stored, rather than how it looks after a query. After all, most joins will violate second normal form.

But yes, SQL doesn't work well with this solution.