[mysql] 쿼리에서 조건문 사용

if 문, case 문, ifnull문

IF 문

형식 : if ( 조건문, 참일때 값, 거짓일때 값)
EX)  select member_id, if ( isnull(birthday), ‘-‘, birthday ) from member
설명 – 멤버 테이블에서 아이디(member_id) 와 생일을 뽑는데 null 일경우는 – 를 출력,
아니면 생일을 출력
 
 

Case 문

형식 :  case (조건 또는 값)
when 값1 then 표시값
when 값2 then 표시값
else 표시값
end
EX)   select case a when ‘1’ then a when ‘2’ then b else c end from table_name
설명 – a 값이 ‘1’이면 a, ‘2’ 이면 b, 둘다 아닐경우 c 를 출력
 
 

ifnull문 ( mysql 에서 사용 )

형식 : ifnull ( 값1, 값2)
EX ) select ifnull ( price, 0 ) from books
설명 – price 값이 Null 이면 0을, Null 이 아니면 price 값을 출력
 
 

isnull문 ( MS-SQL 에서 사용 )

형식 : ifnull ( 값1, 값2)
EX ) select isnull ( price, 0 ) from books
설명 – price 값이 Null 이면 0을, Null 이 아니면 price 값을 출력
 
 

NVL문 ( Oracle 에서 사용 )

형식 : NVL ( 값1, 값2)
EX ) select nvl ( price, 0 ) from books
설명 – price 값이 Null 이면 0을, Null 이 아니면 price 값을 출력

“[mysql] 쿼리에서 조건문 사용”의 133개의 댓글

  1. I like the valuable information you provide in your articles.
    I’ll bookmark your blog and check again here regularly.
    I am quite sure I’ll learn many new stuff right here!
    Best of luck for the next!

  2. Hi there, just became alert to your blog through Google, and found that
    it’s really informative. I’m gonna watch out for brussels.

    I’ll be grateful if you continue this in future.
    Numerous people will be benefited from your writing. Cheers!

  3. I simply want to say I am just very new to blogging and really savored your web site. More than likely I’m want to bookmark your blog post . You really have terrific article content. Many thanks for sharing with us your web site.

  4. The next time I read a blog, I really hope that it does not disappoint me as high as this one. I indicate, I understand it was my option to review, however I actually thought youd have something interesting to claim. All I hear is a number of yawping about something that you might deal with if you werent too busy trying to find interest.

  5. I discovered your blog website on google as well as check a few of your early posts. Continue to keep up the very good operate. I simply extra up your RSS feed to my MSN News Visitor. Looking for forward to learning more from you in the future!?

  6. My developer is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the costs. But he’s tryiong none the less. I’ve been using WordPress on various websites for about a year and am anxious about switching to another platform. I have heard very good things about blogengine.net. Is there a way I can import all my wordpress content into it? Any help would be really appreciated!

  7. Oh my benefits! a remarkable write-up guy. Thank you Nonetheless I am experiencing problem with ur rss. Don?t understand why Incapable to sign up for it. Is there any person obtaining similar rss problem? Any individual that recognizes kindly respond. Thnkx

  8. There are absolutely a great deal of details like that to think about. That is a wonderful point to raise. I provide the thoughts over as basic motivation yet plainly there are questions like the one you raise where the most crucial thing will be operating in truthful good faith. I don?t understand if finest techniques have emerged around things like that, yet I make sure that your job is clearly identified as a level playing field. Both kids and also ladies really feel the impact of just a moment?s pleasure, for the remainder of their lives.

  9. Hello! Someone in my Myspace group shared this website with us so I came to take a look. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers! Terrific blog and outstanding style and design.

  10. I?m satisfied, I should state. Truly rarely do I encounter a blog that?s both informative and amusing, and also let me tell you, you have struck the nail on the head. Your suggestion is superior; the problem is something that inadequate individuals are talking intelligently about. I am very pleased that I came across this in my search for something relating to this.

  11. It’s a pity you don’t have a donate button! I’d most certainly
    donate to this fantastic blog! I guess for now i’ll settle for book-marking and adding your
    RSS feed to my Google account. I look forward to
    brand new updates and will talk about this website with my Facebook group.
    Chat soon!

  12. I?m impressed, I must claim. Really hardly ever do I come across a blog site that?s both enlightening and also enjoyable, and also let me tell you, you have hit the nail on the head. Your concept is superior; the concern is something that inadequate people are talking smartly around. I am very delighted that I came across this in my search for something associating with this.

  13. I am often to blogging as well as i actually value your content. The post has truly peaks my passion. I am going to bookmark your site as well as maintain looking for new information.

  14. After research a few of the post on your website currently, and also I truly like your way of blogging. I bookmarked it to my book mark web site checklist as well as will be inspecting back quickly. Pls look into my website as well as well as let me know what you believe.

  15. When I initially commented I clicked the -Alert me when brand-new comments are added- checkbox as well as currently each time a remark is added I obtain four emails with the same comment. Exists any way you can eliminate me from that solution? Thanks!

  16. When I originally commented I clicked the -Inform me when brand-new remarks are added- checkbox and now each time a comment is added I obtain four e-mails with the very same comment. Exists any way you can remove me from that service? Many thanks!

  17. This is the appropriate blog for any person who wishes to learn about this topic. You understand so much its practically hard to suggest with you (not that I actually would want?HaHa). You most definitely placed a brand-new spin on a subject thats been blogged about for several years. Excellent stuff, just wonderful!

  18. Can I simply say what a relief to discover somebody that actually knows what theyre speaking about on the web. You certainly know just how to bring a problem to light and also make it essential. More people need to read this and also recognize this side of the tale. I cant think youre not much more popular due to the fact that you certainly have the present.

  19. Hello very nice site!! Guy .. Excellent .. Amazing .. I will bookmark your web site and take the feeds additionally? I am glad to find a lot of helpful information right here in the post, we’d like work out more techniques in this regard, thanks for sharing. . . . . .

  20. Oh my benefits! an incredible article guy. Thanks Nonetheless I am experiencing issue with ur rss. Don?t know why Incapable to register for it. Exists any person obtaining the same rss trouble? Any individual that knows kindly respond. Thnkx

  21. Hey there! I just would love to provide a substantial thumbs up for the fantastic information you have here on this message. I will be returning to your blog for more quickly.

  22. Aw, this was an actually good message. In suggestion I would love to put in creating such as this furthermore? requiring time and also actual initiative to make a great short article? yet what can I claim? I procrastinate alot and never appear to get something done.

  23. I simply want to tell you that I am beginner to blogging and site-building and honestly enjoyed this web site. Almost certainly I’m going to bookmark your site . You certainly have incredible article content. Thanks a lot for revealing your web page.

  24. I just want to tell you that I’m new to blogs and definitely loved you’re web site. Probably I’m going to bookmark your blog post . You surely come with remarkable articles. Regards for revealing your blog.

  25. Someone necessarily assist to make seriously articles I might state. This is the first time I frequented your website page and to this point? I surprised with the analysis you made to make this particular publish amazing. Fantastic process!

  26. hi!,I like your writing very so much! proportion we keep in touch more approximately your post on AOL? I require a specialist on this area to unravel my problem. Maybe that is you! Taking a look forward to look you.

  27. The next time I read a blog, I hope that it doesnt disappoint me as a lot as this one. I imply, I do know it was my option to read, however I truly thought youd have something interesting to say. All I hear is a bunch of whining about something that you may fix in case you werent too busy on the lookout for attention.

  28. Nice post. I used to be checking constantly this weblog and I am impressed! Extremely useful info specially the ultimate section 🙂 I care for such information much. I used to be looking for this certain information for a long time. Thanks and good luck.

  29. After exploring a handful of the articles on your website, I truly appreciate your way of writing a blog. I saved it to my bookmark site list and will be checking back soon. Take a look at my web site as well and let me know your opinion.

  30. hey there and thank you on your info – I’ve definitely picked up anything new from right here. I did alternatively expertise a few technical points using this website, as I skilled to reload the website a lot of instances previous to I may just get it to load properly. I had been thinking about if your web host is OK? No longer that I’m complaining, but sluggish loading instances instances will very frequently impact your placement in google and can harm your high quality rating if advertising and ***********|advertising|advertising|advertising and *********** with Adwords. Anyway I am including this RSS to my email and could glance out for much extra of your respective exciting content. Ensure that you update this again very soon..

  31. I intended to create you a little remark to help thank you very much once again just for the pleasing basics you’ve provided on this site. It was really particularly open-handed of people like you to offer openly all that a few individuals could have supplied for an e-book in order to make some dough for themselves, specifically seeing that you could possibly have done it in the event you considered necessary. Those solutions as well worked to become a easy way to recognize that the rest have the same dreams similar to my personal own to know lots more on the subject of this matter. I think there are several more fun sessions in the future for people who read carefully your blog.

  32. I just want to say I am very new to blogs and absolutely liked this web-site. Almost certainly I’m likely to bookmark your blog . You actually have outstanding writings. Thanks a bunch for sharing your webpage.

  33. A motivating discussion is definitely worth comment. I believe that you need to publish more on this topic, it may not be a taboo subject but typically people do not speak about such issues. To the next! Cheers.

  34. Good post. I learn something new and challenging on websites I stumbleupon every day. It will always be exciting to read through content from other authors and use a little something from other websites.

  35. There are some interesting points in time in this article however I don’t know if I see all of them middle to heart. There may be some validity but I will take hold opinion until I look into it further. Good article , thanks and we wish more! Added to FeedBurner as effectively

  36. When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same comment. Is there any way you can remove me from that service? Cheers!

  37. Hello this is kind of of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding know-how so I wanted to get guidance from someone with experience. Any help would be enormously appreciated!

  38. I do like the manner in which you have framed this situation plus it really does supply us some fodder for consideration. However, because of what precisely I have witnessed, I simply just trust as the actual comments stack on that people continue to be on issue and don’t start on a tirade involving the news of the day. Anyway, thank you for this outstanding point and whilst I do not necessarily concur with the idea in totality, I value your viewpoint.

  39. I haven’t checked in here for some time since I thought it was getting boring, but the last few posts are great quality so I guess I will add you back to my daily bloglist. You deserve it my friend 🙂

  40. I just lately came across your blog and have been reading along. I thought I would leave my initial comment. I do not know what to say except that I have liked reading. Good blog. I will keep viewing this blog really usually.

  41. Thanks for the sensible critique. Me and my neighbor were just preparing to do some research on this. We got a grab a book from our local library but I think I learned more clear from this post. I’m very glad to see such excellent information being shared freely out there.

  42. Good post. I be taught something more challenging on different blogs everyday. It’s going to at all times be stimulating to read content material from different writers and follow a little bit one thing from their store. I’d desire to use some with the content on my blog whether or not you don’t mind. Natually I’ll provide you with a link on your net blog. Thanks for sharing.

  43. I simply had to appreciate you once again. I do not know the things that I would’ve used in the absence of the suggestions shown by you directly on my area. It actually was a very daunting setting for me, but looking at the very skilled fashion you handled it made me to weep for contentment. I am grateful for this assistance and trust you really know what a powerful job your are getting into training people today via your blog. Most probably you’ve never met any of us.

  44. We are a gaggle of volunteers and opening a brand new scheme in our community. Your site provided us with valuable info to paintings on. You’ve performed an impressive process and our entire neighborhood might be grateful to you.

  45. After exploring a handful of the blog posts on your web site, I really like your technique of blogging. I bookmarked it to my bookmark webpage list and will be checking back soon. Please check out my website as well and let me know how you feel.

  46. Heya i am for the first time here. I came across this board and I to find It really useful & it helped me out a lot. I hope to present one thing back and help others such as you aided me.

  47. Good post. I learn something new and challenging on websites I stumbleupon everyday. It will always be useful to read articles from other writers and practice something from other sites.

댓글 남기기