in a relational database, can we have a table without any relation with the other tables?
Asked Answered
R

5

6

in a relational database, can we have a table without any relation with the other tables?

Rutger answered 11/1, 2014 at 18:14 Comment(4)
How would you create the first table if every table had to be related to another table?Homunculus
Your database would still be relational but would not be normalized. Whether that is good or bad depends.Oppress
You don't mean "relation", you mean "relationship". And you are (mis)using that word just like some design methods & products.to mean foreign key. As do mispresentations of Entity-Relationship Modeling, where "Relationship" means application relationship. Eg X loves Y. Tables are relations. Relations (base table values and query results) represent application relationships. Any two tables can be JOINed, and the meaning of the result is the AND of the meanings of the arguments. Similarly for all other relational algebra operators.Valentinvalentina
What do you mean by "relation"?Valentinvalentina
I
9

Yes. The way relations are expressed are with foreign keys. If a table you generate has no Foreign keys, and no foreign keys in other tables point to this table, it has no relationships.

It can still be given a relationship later though so don't worry about shooting yourself in the foot.

Inca answered 11/1, 2014 at 18:16 Comment(1)
But in the Relational Model "relation" means both a relationship/association & a table representing one & in the Entity-Relationship Model "relationship" similarly means association. They don't use "relation"/"relationship" for FK. And even in pseudo-ER methods that call themselves ER that use "relationship" for FK they don't use "relation" for that.Valentinvalentina
R
4

Of course. Even you can create a table without fields.

Riddell answered 11/1, 2014 at 18:22 Comment(1)
But not in SQL.Valentinvalentina
U
2

Yes you can. Tables do not have to have any relation to each other. Relations can always be added through the use of foreign keys if you want to add them later.

Unparliamentary answered 11/1, 2014 at 18:16 Comment(0)
M
1

Your question belies a larger problem with your understanding of databases.

A relation is a set of tuples (a relation can be thought of as a table). A tuple can be thought of as a row.

Relationship in English means connectedness and has nothing to do with relation from relational databases.

Both relation and relationship share word roots, but in database theory, these words/concepts do not have anything to do with each other.

The root of the word relation in database theory comes from math (see function vs relation).

Milkandwater answered 14/10, 2021 at 16:17 Comment(0)
N
0

I'm creating a company management database and I have a "Company_Expenses" table that I just need for summery reports on the Company's revenues. I can't think of anything this table might need to be connected to so it's just on it's own for now.

enter image description here

Neville answered 28/12, 2016 at 10:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.