Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have the following table: CONSULTANT (CON#, Cname, Expertise, DNUMBER) c1 Jo

ID: 3735986 • Letter: Y

Question

You have the following table:

CONSULTANT (CON#,        Cname,            Expertise,        DNUMBER)

                                                c1                    Joy                  C/S                  1

                                                c2                    Bob                 OOSA             1

                                                c3                    Jack                 C++                 5

                                                c4                    Cindy              Oracle              NULL

Write SQL statement that prints CON#, Cname, and Expertise. Display Expertises by converting from C++ to Java and from OOSA to UML. Others remain the same.

(Can I display 'Java' instead of 'C++' without updating the table?

Explanation / Answer

SELECT CON#,Cname,Expertise, CASE WHEN Expertise = 'C++' THEN 'Java' WHEN Expertise = 'OOSA' THEN 'UML' END FROM CONSULTANT;


Case statement in sql is used to display the customized values of attribute if the condition is true. Thus when Expertise value in a row is C++ , it will display Java and when Exoertise value is OOSA , it will display UML as Expertise. The Case will not change the actual values in the table.

Do ask if any doubt. Please upvote.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote