dbTalk Databases Forums  

Re: Advanced SQL

comp.databases.theory comp.databases.theory


Discuss Re: Advanced SQL in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Cressey
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 12:13 AM







"David Portas" <REMOVE_BEFORE_REPLYING_dportas (AT) acm (DOT) org> wrote


Quote:
Call me picky but I am not entirely comfortable with that U.Texas site,
even
though it's a commendable effort overall.

"The relational model represents data in the form of two-dimension tables"
"A relational table is a flat file ..."
"Primary and foreign keys are the most basic components on which
relational
theory is based."
"The definition of second normal form states that only tables with
composite
primary keys can be in 1NF but not in 2NF"
"The third normal form requires that all columns in a relational table are
dependent only upon the primary key"

I'm not entirely comfortable with it myself, and I had found some of the
same things you quoted. I still recommend it. I'm looking for something
that's better. when I find it, I'll recommend that.





Reply With Quote
  #2  
Old   
Jon Heggland
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 08:43 AM






Quoth Evan Keel:
Quote:
"David Portas" <REMOVE_BEFORE_REPLYING_dportas (AT) acm (DOT) org> wrote in message
newsZSdnfih_oRy5H3bRVnyigA (AT) giganews (DOT) com...
Call me picky but I am not entirely comfortable with that U.Texas site,
even though it's a commendable effort overall.

"The definition of second normal form states that only tables with
composite primary keys can be in 1NF but not in 2NF"

They have it right here. All non-key attributes must be dependent on the
full key. Only applies to tables with keys composed of multiple columns
No. There may be dependencies where the left side is empty. But it's a
common mistake. If I remember correctly, one of my database textbooks
"proves" that any relvar with just two attributes is automatically in BCNF.
--
Jon


Reply With Quote
  #3  
Old   
Jan Hidders
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 08:59 AM



On 7 sep, 15:43, Jon Heggland <jon.heggl... (AT) idi (DOT) ntnu.no> wrote:
Quote:
Quoth Evan Keel:

"David Portas" <REMOVE_BEFORE_REPLYING_dpor... (AT) acm (DOT) org> wrote in message
newsZSdnfih_oRy5H3bRVnyigA (AT) giganews (DOT) com...
Call me picky but I am not entirely comfortable with that U.Texas site,
even though it's a commendable effort overall.

"The definition of second normal form states that only tables with
composite primary keys can be in 1NF but not in 2NF"

They have it right here. All non-key attributes must be dependent on the
full key. Only applies to tables with keys composed of multiple columns

No. There may be dependencies where the left side is empty.
In that case the declared candidate key is not really a candidate
key. Under the assumption that the declared candidate keys are indeed
candidate keys, the claim is correct.

Quote:
But it's a
common mistake. If I remember correctly, one of my database textbooks
"proves" that any relvar with just two attributes is automatically in BCNF.
Under the assumption that I just mentioned, that claim is actually
also correct.

-- Jan Hidders



Reply With Quote
  #4  
Old   
David Cressey
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 09:19 AM




"Jan Hidders" <hidders (AT) gmail (DOT) com> wrote

Quote:
On 7 sep, 15:43, Jon Heggland <jon.heggl... (AT) idi (DOT) ntnu.no> wrote:
Quoth Evan Keel:

"David Portas" <REMOVE_BEFORE_REPLYING_dpor... (AT) acm (DOT) org> wrote in
message
newsZSdnfih_oRy5H3bRVnyigA (AT) giganews (DOT) com...
Call me picky but I am not entirely comfortable with that U.Texas
site,
even though it's a commendable effort overall.

"The definition of second normal form states that only tables with
composite primary keys can be in 1NF but not in 2NF"

They have it right here. All non-key attributes must be dependent on
the
full key. Only applies to tables with keys composed of multiple
columns

No. There may be dependencies where the left side is empty.

In that case the declared candidate key is not really a candidate
key. Under the assumption that the declared candidate keys are indeed
candidate keys, the claim is correct.

I'm really confused by the above. First off, if there were a dependency
where the left side is empty, wouldn't the same value have to exist the
dependent column, for all of the rows?


Quote:
But it's a
common mistake. If I remember correctly, one of my database textbooks
"proves" that any relvar with just two attributes is automatically in
BCNF.

Under the assumption that I just mentioned, that claim is actually
also correct.

-- Jan Hidders




Reply With Quote
  #5  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 12:40 PM




"Jan Hidders" <hidders (AT) gmail (DOT) com> wrote

Quote:
On 7 sep, 15:43, Jon Heggland <jon.heggl... (AT) idi (DOT) ntnu.no> wrote:
Quoth Evan Keel:

"David Portas" <REMOVE_BEFORE_REPLYING_dpor... (AT) acm (DOT) org> wrote in
message
newsZSdnfih_oRy5H3bRVnyigA (AT) giganews (DOT) com...
Call me picky but I am not entirely comfortable with that U.Texas
site,
even though it's a commendable effort overall.

"The definition of second normal form states that only tables with
composite primary keys can be in 1NF but not in 2NF"

They have it right here. All non-key attributes must be dependent on
the
full key. Only applies to tables with keys composed of multiple
columns

No. There may be dependencies where the left side is empty.

In that case the declared candidate key is not really a candidate
key. Under the assumption that the declared candidate keys are indeed
candidate keys, the claim is correct.

That's not true, Jan, consider:

{A, B, C} | A --> B /\ {} --> C

If {} --> C holds, then A --> C also holds.
Since A --> B /\ A --> C, then A --> BC.

{{A:1, B:2, C:1}
{A:2, B:4, C:1}
{A:3, B:4, C:1}
{A:4, B:3, C:1}}

Clearly A is the only candidate key, even though the FD {} --> C holds.

Quote:
But it's a
common mistake. If I remember correctly, one of my database textbooks
"proves" that any relvar with just two attributes is automatically in
BCNF.

Under the assumption that I just mentioned, that claim is actually
also correct.

-- Jan Hidders




Reply With Quote
  #6  
Old   
Jan Hidders
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 02:29 PM



On 7 sep, 19:40, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
Quote:
"Jan Hidders" <hidd... (AT) gmail (DOT) com> wrote in message

news:1189173585.627344.49900 (AT) 19g2000hsx (DOT) googlegroups.com...



On 7 sep, 15:43, Jon Heggland <jon.heggl... (AT) idi (DOT) ntnu.no> wrote:
Quoth Evan Keel:

"David Portas" <REMOVE_BEFORE_REPLYING_dpor... (AT) acm (DOT) org> wrote in
message
newsZSdnfih_oRy5H3bRVnyigA (AT) giganews (DOT) com...
Call me picky but I am not entirely comfortable with that U.Texas
site,
even though it's a commendable effort overall.

"The definition of second normal form states that only tables with
composite primary keys can be in 1NF but not in 2NF"

They have it right here. All non-key attributes must be dependent on
the
full key. Only applies to tables with keys composed of multiple
columns

No. There may be dependencies where the left side is empty.

In that case the declared candidate key is not really a candidate
key. Under the assumption that the declared candidate keys are indeed
candidate keys, the claim is correct.

That's not true, Jan, consider:

{A, B, C} | A --> B /\ {} --> C

If {} --> C holds, then A --> C also holds.
Since A --> B /\ A --> C, then A --> BC.

{{A:1, B:2, C:1}
{A:2, B:4, C:1}
{A:3, B:4, C:1}
{A:4, B:3, C:1}}

Clearly A is the only candidate key, even though the FD {} --> C holds.
Indeed, I stand corrected.

-- Jan Hidders



Reply With Quote
  #7  
Old   
Jan Hidders
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 02:35 PM



On 7 sep, 16:19, "David Cressey" <cresse... (AT) verizon (DOT) net> wrote:
Quote:
"Jan Hidders" <hidd... (AT) gmail (DOT) com> wrote in message

news:1189173585.627344.49900 (AT) 19g2000hsx (DOT) googlegroups.com...



On 7 sep, 15:43, Jon Heggland <jon.heggl... (AT) idi (DOT) ntnu.no> wrote:
Quoth Evan Keel:

"David Portas" <REMOVE_BEFORE_REPLYING_dpor... (AT) acm (DOT) org> wrote in
message
newsZSdnfih_oRy5H3bRVnyigA (AT) giganews (DOT) com...
Call me picky but I am not entirely comfortable with that U.Texas
site,
even though it's a commendable effort overall.

"The definition of second normal form states that only tables with
composite primary keys can be in 1NF but not in 2NF"

They have it right here. All non-key attributes must be dependent on
the
full key. Only applies to tables with keys composed of multiple
columns

No. There may be dependencies where the left side is empty.

In that case the declared candidate key is not really a candidate
key. Under the assumption that the declared candidate keys are indeed
candidate keys, the claim is correct.

I'm really confused by the above. First off, if there were a dependency
where the left side is empty, wouldn't the same value have to exist the
dependent column, for all of the rows?
Yes. But as Brian correctly pointed out, what I said in the above was
wrong. In fact my remark about binary relations in BCNF is also not
correct. For example R(A,B) with FD {}-->B is not in BCNF. Not my day,
apparently. :-(

-- Jan Hidders



Reply With Quote
  #8  
Old   
David Portas
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 03:00 PM



"Evan Keel" <evankeel (AT) sbcglobal (DOT) net> wrote

Quote:
"David Portas" <REMOVE_BEFORE_REPLYING_dportas (AT) acm (DOT) org> wrote in message
newsZSdnfih_oRy5H3bRVnyigA (AT) giganews (DOT) com...
"David Cressey" <cressey73 (AT) verizon (DOT) net> wrote in message
news:HBTDi.14699$tB2.1005 (AT) trndny05 (DOT) ..

There are two webistes I can recommend:


http://www.utexas.edu/its-archive/wi.../overview.html

For an overview to data modeling and database design.

and

http://www.databaseanswers.org/

For about 200 free database designs, covering many common problems.
You
will want to revise the design to suit your own requirements.




Call me picky but I am not entirely comfortable with that U.Texas site,
even
though it's a commendable effort overall.

"The relational model represents data in the form of two-dimension
tables"
"A relational table is a flat file ..."
"Primary and foreign keys are the most basic components on which
relational
theory is based."
"The definition of second normal form states that only tables with
composite
primary keys can be in 1NF but not in 2NF"

They have it right here. All non-key attributes must be dependent on the
full key. Only applies to tables with keys composed of multiple columns

"The third normal form requires that all columns in a relational table
are
dependent only upon the primary key"

They have it right again. No transitive dependecies. So the problem? Oh
yes,
remove the candidate key in this test.

http://www.utexas.edu/its/windows/da.../overview.html
http://www.utexas.edu/its/windows/da...ng/rm/rm1.html
http://www.utexas.edu/its/windows/da...g/dm/keys.html
http://www.utexas.edu/its/windows/da...ng/rm/rm7.html

--
David Portas




The case already mentioned by Jon is one exception to the statement about
2NF.

Normalization is concerned with candidate keys not just primary keys, so the
definitions are necessary conditions but not sufficient ones.

--
David Portas




Reply With Quote
  #9  
Old   
David Cressey
 
Posts: n/a

Default Re: Advanced SQL - 09-07-2007 , 04:40 PM




"David Portas" <REMOVE_BEFORE_REPLYING_dportas (AT) acm (DOT) org> wrote

Quote:
"Evan Keel" <evankeel (AT) sbcglobal (DOT) net> wrote in message
news:Np%Di.5257$JD.656 (AT) newssvr21 (DOT) news.prodigy.net...

"David Portas" <REMOVE_BEFORE_REPLYING_dportas (AT) acm (DOT) org> wrote in message
newsZSdnfih_oRy5H3bRVnyigA (AT) giganews (DOT) com...
"David Cressey" <cressey73 (AT) verizon (DOT) net> wrote in message
news:HBTDi.14699$tB2.1005 (AT) trndny05 (DOT) ..

There are two webistes I can recommend:



http://www.utexas.edu/its-archive/wi.../overview.html

For an overview to data modeling and database design.

and

http://www.databaseanswers.org/

For about 200 free database designs, covering many common problems.
You
will want to revise the design to suit your own requirements.




Call me picky but I am not entirely comfortable with that U.Texas site,
even
though it's a commendable effort overall.

"The relational model represents data in the form of two-dimension
tables"
"A relational table is a flat file ..."
"Primary and foreign keys are the most basic components on which
relational
theory is based."
"The definition of second normal form states that only tables with
composite
primary keys can be in 1NF but not in 2NF"

They have it right here. All non-key attributes must be dependent on the
full key. Only applies to tables with keys composed of multiple columns

"The third normal form requires that all columns in a relational table
are
dependent only upon the primary key"

They have it right again. No transitive dependecies. So the problem? Oh
yes,
remove the candidate key in this test.


http://www.utexas.edu/its/windows/da.../overview.html
http://www.utexas.edu/its/windows/da...ng/rm/rm1.html
http://www.utexas.edu/its/windows/da...g/dm/keys.html
http://www.utexas.edu/its/windows/da...ng/rm/rm7.html

--
David Portas





The case already mentioned by Jon is one exception to the statement about
2NF.

Normalization is concerned with candidate keys not just primary keys, so
the
definitions are necessary conditions but not sufficient ones.

Yes. You will note, IIRC, that the website discusses normalization
repeatedly as if the primary key were the only key under consideration.
Indeed, when I first learned normalization, I learned it this wrong way.
Not from this website, but from another source.


Quote:
--
David Portas





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.