# Thread: what is mean by (cardnalty)

1. ## 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?

2. 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

3. 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?..

4. Originally Posted by jemz
Hi r937, Okay so it mean by number of rows?..
i'm not sure

5. 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.

6. okay, just to check to make sure, run this for each table and tell me what you get --
Code:
`SELECT COUNT(*) FROM table`

7. 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

8. that's weird

could you do this for both tables please --
Code:
`SHOW CREATE TABLE table`

9. 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...

10. 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
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
6
it has 6 records.

11. 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.

12. Thank you for the reply

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•