dimanche 1 mai 2016

SQL - Select all Rows, from specific columns, whilst counting individual things

I'm trying to work this out in SQLite3, and been failing for hours now!

Imagine I have this table (named products), for example purposes:

Company | Product | Price (£)
--------|---------|----------
Apple   | iPhone  |   349
Samsung | Galaxy  |   300
Sony    | PS4     |   229
Sony    | Xperia  |   249

What query would I use, to show how many products there are by each company? Presenting similar results to the following:

Company |   ???
--------|---------
Apple   | 1 
Samsung | 1 
Sony    | 2     

Any help would be much appreciated, as it's stressing me out!

Thanks!

Aucun commentaire:

Enregistrer un commentaire