database-theory

SQL Query theory question - single-statement vs multi-statement queries

When I write SQL queries, I find myself often thinking that "there's no way to do this with a single query". When that happens I often turn to stored procedures or multi-statement table-valued functions that use temp tables (of one sort or another) and end up simply combining the results and returning the result table. I'm wondering if...

Using a user-defined type as a primary key

Suppose I have a system where I have metadata such as: table: ====== key name address ... Then suppose I have a user-defined type described as so: datasource datasource-key A) are there systems where it's possible to have keys based on user-defined types? B) if so, how do you decompose the keys into a form sui...

On the relationship of database tables to a pivot/junction table

In a database, one may create a many-to-many relationship between tables by creating a third table which maps the two together using foreign keys. What is the relationship between the third table and the two original tables? For example, if table A and table B have a many-to-many relationship and table AB is the pivot table, is the A->...

What does the symbol "⊇" mean?

In the attached picture there's a symbol I don't understand. To understand additive functional dependency I need to know what the symbol means. Please advice? It's the symbol where it says: "Suppose that X ⊇ Y and that..." ⊇ = ? Thanks! ...

The Relational Model & Queries That Naturally Return Duplicate Rows

It's commonly understood that in the relational model: Every relational operation should yield a relation. Relations, being sets, cannot contain duplicate rows. Imagine a 'USERS' relation that contains the following data. ID FIRST_NAME LAST_NAME 1 Mark Stone 2 Jane Stone 3 Michael Stone If someone runs a query se...