Home » SQL & PL/SQL » SQL & PL/SQL » Cardinality Examples
Cardinality Examples Mon, 09 April 2007 12:15
 wtolentino Messages: 197Registered: March 2005 Senior Member
can anyone provide me some simple examples or explanations of cardinality in oracle. thanks.
Re: Cardinality Examples [message #229676 is a reply to message #229675] Mon, 09 April 2007 12:24
 BlackSwan Messages: 25571Registered: January 2009 Location: SoCal Senior Member
Unwilling or incapable to RTFM?

http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref1021

Re: Cardinality Examples [message #229683 is a reply to message #229676] Mon, 09 April 2007 13:08
 wtolentino Messages: 197Registered: March 2005 Senior Member
thank you for providing the link. in your own how do you express or define a cardinality?
Re: Cardinality Examples [message #229686 is a reply to message #229675] Mon, 09 April 2007 13:15
 BlackSwan Messages: 25571Registered: January 2009 Location: SoCal Senior Member
I do NOT believe in reinventing the wheel.
http://en.wikipedia.org/wiki/Cardinality
You're On Your Own (YOYO)!
Re: Cardinality Examples [message #229692 is a reply to message #229683] Mon, 09 April 2007 13:33
 William Robertson Messages: 1642Registered: August 2003 Location: London, UK Senior Member
http://www.google.com/search?q=define%3Acardinality

In Oracle it seems to depend on the context. It means either the total number of rows (in a table, returned by a step of an execution plan etc), or else the number of distinct values. The CARDINALITY() SQL function itself returns the number of elements in a nested table.

```SELECT CARDINALITY(test.tt)
, CARDINALITY(SET(test.tt))
FROM   ( SELECT INTEGER_TT(1,1,1,1,5) AS tt FROM dual ) test;

CARDINALITY(TEST.TT) CARDINALITY(SET(TEST.TT))
-------------------- -------------------------
5                         2

1 row selected.```

From the Data Warehousing Guide Glossary:

 Cardinality From an OLTP perspective, this refers to the number of rows in a table. From a data warehousing perspective, this typically refers to the number of distinct values in a column. For most data warehouse DBAs, a more important issue is the degree of cardinality.

 Previous Topic: sql code asking for username and password when running a batch file Next Topic: HELP!!! Oracle DATE Functions...Query data 5 months prior
Goto Forum:

Current Time: Sun Aug 20 12:30:33 CDT 2017

Total time taken to generate the page: 0.05391 seconds