Question: Given the three tables, write out what you think the output would be if the SQL code were executed. Refer to this tutorial (https://mode.com/sql-tutorial/sql-case/) to

Given the three tables, write out what you think the output would be if the SQL code were executed.

Refer to this tutorial (https://mode.com/sql-tutorial/sql-case/) to understand how to interpret CASE statements.

Given the three tables, write out what you think the output wouldbe if the SQL code were executed. Refer to this tutorial (https://mode.com/sql-tutorial/sql-case/)

User ID 1 2 3 email john@gmail.com tom@gmail.com sarah@gmail.com nicole@gmail.com tim@gmail.com name john tom sarah nicole time 4 5 Devices ID 1 2 3 4 5 User_id 3 3 1 desc mobile macbook mobile pc mobile active yes yes no 4 no 4 yes File ID 1 2 3 4 5 User_id 3 3 3 4 4 File_type photo doc Mp3 photo photo File_name Selfie.jpg Todo.docx Song 1.mp3 Vacation 1.jpg Vacation2.jpg 3. = SELECT ID, CASE When File_type = 'photo' Then 'Photo' When File_type = "MP3' Then 'Not Photo' Else 'Not photo nor MP3 End as File_type From File 4. SELECT User.ID, User Name, Device.desc, CASE WHEN Device.desc = 'mobile' Then 'It's a mobile WHEN Device.desc = 'macbook' Then 'It's a macbook' ELSE 'Not mobile nor macbook' END as Device Text FROM User Join Device On user.ID = Device.user_id User ID 1 2 3 email john@gmail.com tom@gmail.com sarah@gmail.com nicole@gmail.com tim@gmail.com name john tom sarah nicole time 4 5 Devices ID 1 2 3 4 5 User_id 3 3 1 desc mobile macbook mobile pc mobile active yes yes no 4 no 4 yes File ID 1 2 3 4 5 User_id 3 3 3 4 4 File_type photo doc Mp3 photo photo File_name Selfie.jpg Todo.docx Song 1.mp3 Vacation 1.jpg Vacation2.jpg 3. = SELECT ID, CASE When File_type = 'photo' Then 'Photo' When File_type = "MP3' Then 'Not Photo' Else 'Not photo nor MP3 End as File_type From File 4. SELECT User.ID, User Name, Device.desc, CASE WHEN Device.desc = 'mobile' Then 'It's a mobile WHEN Device.desc = 'macbook' Then 'It's a macbook' ELSE 'Not mobile nor macbook' END as Device Text FROM User Join Device On user.ID = Device.user_id

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!