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?

where did you learn about this?

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

Hi r937, Okay so it mean by number of rows?..:slight_smile:

i’m not sure

where did you learn about this?

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

okay, just to check to make sure, run this for each table and tell me what you get –

SELECT COUNT(*) FROM [I]table[/I]

it returns number of records :slight_smile: 7

that’s weird

could you do this for both tables please –

SHOW CREATE TABLE [I]table[/I]

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…

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.

Stack Overflow has some good explanations of the different meanings of cardinality in databases … http://stackoverflow.com/questions/10621077/what-is-cardinality-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.

Thank you for the reply :slight_smile: