6
Ex. mysql_query("SELECT * FROM members WHERE id='$id');
user784637
  • 15,392
  • 32
  • 93
  • 156

5 Answers5

12

It means select all columns in the table.

Jon Martin
  • 3,252
  • 5
  • 29
  • 45
7

It means that you are selecting every column in the table. This is something you should avoid in production environments though because it causes a bit of overhead and things tend to break when you alter your tables and use the * selector.

A better way to do this is to select only the columns you need each time, like the following example:

SELECT `id`, `firstName`, `lastName` FROM members WHERE id='$id'
aldavigdis
  • 635
  • 6
  • 17
4

It means "Select All", referring to all columns in referenced table. The issue with * relates to insert statements with existing tables or select statements used in a static report template. Any change in the referenced table would cause a change in the returned result set using *. If the insert or report source recordset has any additional or missing columns, the query may break. The main point is that using * can give you inconsistent columns and recordsets.

Geoffrey Fuller
  • 186
  • 1
  • 6
  • 1
    This should probably be a comment on the answer you've referenced since it doesn't answer the question itself. – Jeff B Mar 23 '17 at 21:31
  • 1
    That's a fair point. I just wanted to give some examples of the issue that I have encountered. I don't have enough reputation points to post a comment to someone else's answer. – Geoffrey Fuller Mar 23 '17 at 21:38
  • This is the best answer, since it tells readers why using it is not a golden hammer solution. – Robert Columbia Jun 05 '19 at 15:47
4

Select ALL fields from some table.

Nikola Despotoski
  • 49,966
  • 15
  • 119
  • 148
4

It's a wildcard it means return all columns for that table in the result set.

Jesus Ramos
  • 22,940
  • 10
  • 58
  • 88