Back in 2015 during a beautiful Christmas season snow storm I took my Nikon D2x,a 12 megapixel pro-type dslr and my Nikon Coolpix,also a 12 megapixel, and shot the same scenes, side by side and with similar angles of view, with a zoom lens on each camera. The Nikon d2x with its much larger 12 megapixel sensor was slightly better. The Coolpix has a really good zoom lens for a pocket camera, and it is Tiny-- smaller than a pack of cigarettes by about 30%. I paid $5,000 for the D2x brand new in May of 2005, and I paid $7 for the Coolpix in 2015 from a thrift shop.
I have a Canon Powershot G3 I think it is and I also paid $7 for it. It is a 3.8 megapixel I believe, and it shoots pretty good pictures, and it retailed for around eight hundred bucks when it was new and current. I paid $7 for it at Goodwill, and it shoots Raw and has full manual exposure control, and uses Canon 20D type batteries I want to call them BP - 511 batteries. Even though it is a 3.8 megapixel it has a really decent lens and it shoots surprisingly good photos, especially in raw, but my 10 year newer iPhone shoots much better video. the Canon shoots very small videos.
Once again, it is not just the megapixel count, but the quality of the megapixels. Newer sensors offer better quality than older sensors, in most cases, but the quality of the lens plays a significant part. One can take a 24 megapixel sensor and shooting through a Lensbaby or a cheap lens, reduce the output quality significantly. I was always impressed with the iPhone 4 and its lens. Even though it was only a 5-megapixel camera, the lens was of surprisingly good quality, and not just for a phone lens-- it had a really good lens, and I made many good pictures with my iPhone 4.