ELT() returns the string from ELTs argument list at the position provided by FIELD(). In the code that follows, FIELD() returns the argument list position of the string that matches Age. Got a question for us? Please mention it in the comments section of ”DECODE in SQL” and I will get back to you.Another MySQL option that may look more like Oracle's DECODE is a combination of FIELD and ELT. If you wish to learn more about MySQL and get to know this open-source relational database, then check out our MySQL DBA Certification Training which comes with instructor-led live training and real-life project experience. This training will help you understand MySQL in-depth and help you achieve mastery over the subject. I hope the article helped you with the concepts of the DECODE statement. Now, try using them whenever any IF-ELSE logic is required while working on SQL. This is all about DECODE function, by now you must have got a clear picture of how it works and how useful this function is. Here, you need to create a formula that will evaluate to a single number for each one of your ranges.ĭECODE(TRUNC (( hours_of_work + 3) / 4), 0, 0.04, If hours_of_work = 1 and 5 then return 0.06
0 Comments
Leave a Reply. |