# what is mean by (cardnalty)

• Jan 20, 2013, 11:30
jemz
what is mean by (cardnalty)
Hi, I am confuse about this cardinality i found out that some of my table have 5 cardinality other table have 20..what does cardinality mean and is this important?
• Jan 20, 2013, 15:38
r937
Quote:

Originally Posted by jemz
i found out that some of my table have 5 cardinality other table have 20..

i think all it means is the number of rows in the table
• Jan 20, 2013, 20:58
jemz
Quote:

Originally Posted by r937

i think all it means is the number of rows in the table

Hi r937, Okay so it mean by number of rows?..:)
• Jan 20, 2013, 21:55
r937
Quote:

Originally Posted by jemz
Hi r937, Okay so it mean by number of rows?..:)

i'm not sure

• Jan 20, 2013, 22:11
jemz
Quote:

Originally Posted by r937
i'm not sure

Hi r937,I saw this in my wamp server,when i open my tables i and then click the structure of my table there i saw the cardinality...i am just curious about this..thank you so much for the reply. :)
• Jan 20, 2013, 22:20
r937
okay, just to check to make sure, run this for each table and tell me what you get --
Code:

`SELECT COUNT(*) FROM table`
• Jan 21, 2013, 04:18
jemz
Quote:

Originally Posted by r937
okay, just to check to make sure, run this for each table and tell me what you get --
Code:

`SELECT COUNT(*) FROM table`

it returns number of records :) 7
• Jan 21, 2013, 07:53
r937
that's weird

could you do this for both tables please --
Code:

`SHOW CREATE TABLE table`
• Jan 21, 2013, 08:47
StarLion
The Cardinality of a column would be equal to the number of rows returned by SELECT DISTINCT `column1` FROM table1...

how this would be calculated for a TABLE... i dont know. Because surely every row in your table has SOME uniqueness...
• Jan 22, 2013, 09:12
jemz
Quote:

Originally Posted by r937
that's weird

could you do this for both tables please --
Code:

`SHOW CREATE TABLE table`

Hi r937, this is the result of show create table
Quote:

CREATE TABLE `userref` ( `id` int(11) NOT NULL AUTO_INCREMENT, `First` varchar(20) NOT NULL, `Last` varchar(20) NOT NULL, `MI` varchar(1) NOT NULL, `Addss` varchar(50) NOT NULL, `phone` varchar(11) NOT NULL, `Email` varchar(30) NOT NULL, `Userident` varchar(20) NOT NULL, `Pass` varchar(200) NOT NULL, `Stat` varchar(1) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1

i tried to select count(*) from userref
it returns
Quote:

6
it has 6 records.
• Jan 22, 2013, 09:40
WebMachine
Stack Overflow has some good explanations of the different meanings of cardinality in databases ... http://stackoverflow.com/questions/1...y-in-databases .

"When talking about database query optimization, cardinality refers to the data in a column of a table, specifically how many unique values are in it. This statistic helps with planning queries and optimizing the execution plans."

or

"When you are looking at query plans, cardinality refers to the number of rows that are expected to be returned from a particular operation."

might be what you are looking for.
• Jan 22, 2013, 10:14
jemz
Thank you for the reply :)