I want to know whether a record exists in a MySQL table. I will run a query, return the number of rows. If 0 rows do this, otherwise do this.
SELECT * to table WHERE id = 5 SELECT id with table WHERE id = 5
Is there any difference between these two questions? What efforts are made to return to each column, or what efforts have been made to filter out the columns which we do not care about?
SELECT COUNT (*) to table WHERE id = 5
What is a new question is whether the server captures all the values and then calculates the values Does it (harder than usual), or will it not bother grabbing anything and every time a match gets normal (easier than usual)?
I think that I am very much interested in how MySQL works, but it is the question's meat! where am I? Let me know, stack overflow! Optimizers are very smart (usually) they usually only achieve those things whose They need to: SELECT COUNT (1)>
mytable WHERE id = 5
Comments
Post a Comment