You mean "unnormalized" not "de-normalized". The latter is when normalized base tables are replaced by others whose values are always the join of the orignals. You need to find out from whoever gave you the asignment whether unnormalized form here means your first design attempt or specifically a "universal relation" that is an appropriate join of all those. That would be de-normalizing.
Every base table and query result holds the rows that make some predicate (statement parameterized by columns) into a true proposition (statement).
SELECT * FROM EMP
"employee [E] is named [N] and has dependent [D]"
SELECT * FROM DEP
"employee [E] works for department [D]"
- query
SELECT E, N FROM EMP
for some D, "employee [E] is named [N] and has dependent [D]"
("employee [E] is named [N] and has some dependent")
An SQL FROM
makes a temporary table that you can think of as having columns T.C for each column C of each table T. For inner JOIN
s (ie INNER
, CROSS
and plain) this temporary table is a cross join. It's predicate is the AND of the predicates of the joined tables. ON
and WHERE
conditions are also ANDed into the predicate. The SELECT
clause renames the temporary columns so there are no "."s. (Athough SQL does that implicity if there's no ambiguity.)
- query
SELECT EMP.E AS E, N, DEP.D AS D FROM EMP JOIN DEP
"for some EMP.D, employee [EMP.E] is named [EMP.N] and has dependent [EMP.D]"
AND "employee [DEP.E] works for department [DEP.D]"
(ie "employee [E] is named [N] and has some dependent and works for department [D]")
Note that it doesn't matter what constraints hold. (Including UNIQUE
, PRIMARY KEY
,FOREIGN KEY
& CHECK
). Constraints just tell you that tables are limited in the values they will ever hold. In fact the constraints are determined by the predicates and the situations that can arise.
If you know that it's always the case that T1.C =
T2.C for some column C of tables T1 & T2 then you only have to SELECT
one of them, AS C
. If every column C is always equal in every table then NATURAL JOIN
does the appropriate =
and the AS
without having to mention any columns.
(More re predicates & SQL.)
PS The single-base version of a database is not a base whose value is the FULL
( OUTER
) JOIN
of separate bases. First, normalization does not deal with NULL
s, so you would have to remove them from any OUTER JOIN
result, more or less giving you your tables back. Second, FULL JOIN
is in general not associative, ie (T1 FULL JOIN T2) FULL JOIN T3
<> T1 FULL JOIN (T2 JOIN T3)
, so there is no such thing as "the FULL JOIN` of more than two tables". Third, even with just two tables their FULL JOIN does not in general allow you to reconstruct their values.
PPS There is no "0th Normal Form". There are different uses of "1st Normal Form". Sometimes it just means being a relation, and sometimes it means being a relation with no relation-valued attributes, and it is also frequently used in various other confused/nonsensible ways that are really about aspects of good design.