Question: Tables User ID email name 1 john@gmail.com john 2 tom@gmail.com tom 3 sarah@gmail.com sarah 4 nicole@gmail.com nicole 5 tim@gmail.com time Devices ID User id desc



Tables User ID email name 1 john@gmail.com john 2 tom@gmail.com tom 3 sarah@gmail.com sarah 4 nicole@gmail.com nicole 5 tim@gmail.com time Devices ID User id desc active 1 3 mobile yes 2 3 macbook yes 3 1 mobile no 4 4 pc no 5 4 mobile yes File ID User id File_type File_name 1 3 photo Selfie.jpg 2 3 doc Todo.docx 3 3 Mp3 Song1.mp3 4 4 photo Vacation 1.jpg 5 4 photo Vacation2.jpg_I Questions 1. How many users are in our user table? 2. Who has mobile devices listed in the devices table? 3. How many devices are active? List by highest number of devices first. SELECT Count(*) as total_devices FROM decides d WHERE d.active = ORDER BY total_devices DESC 4. Which devices does Nicole have listed? SELECT d.desc FROM devices d JOIN user u on u.id = d.user_id WHERE u.name =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
