SQL WHERE Clause

The SQL WHERE syntax

A WHERE clause with a SELECT statement:

  1. SELECT columnnames
  2. FROM tablename
  3. WHERE condition

A WHERE clause with an UPDATE statement:

  1. UPDATE tablename
  2. SET columnname = value
  3. WHERE condition

A WHERE clause with a DELETE statement:

  1. DELETE tablename
  2. WHERE condition

 


SQL WHERE Clause Examples

Problem: List the customers in Sweden

  1. SELECT Id, FirstName, LastName, City, Country, Phone
  2. FROM Customer
  3. WHERE Country = ‘Sweden’

Results:  2 records

Id FirstName LastName City Country Phone
5 Christina Berglund Luleå Sweden 0921-12 34 65
24 Maria Larsson Bräcke Sweden 0695-34 67 21

 


Problem: Update the city to Sydney for supplier Pavlova, Ltd.

  1. UPDATE Supplier
  2. SET City = ‘Sydney’
  3. WHERE Name = ‘Pavlova, Ltd.’

Results: 1 record updated.


Problem: Delete all products with unit price higher than $50.

  1. DELETE FROM Product
  2. WHERE UnitPrice > 50

Results: 7 records deleted.
Note: Referential integrity may prevent this deletion.
A better approach may be to discontinue the product, that is, set IsDiscontinued to true.

“SQL WHERE Clause”의 84개의 댓글

  1. I simply want to say I am just beginner to weblog and really savored you’re web page. Probably I’m going to bookmark your blog post . You certainly come with beneficial well written articles. With thanks for revealing your website page.

  2. 핑백: w88club

  3. 핑백: 온라인홀덤

  4. 핑백: mơ thấy gạo đánh con gì

  5. 핑백: Guns for Sale online

  6. 핑백: tor onion links 2020

  7. 핑백: affiliate marketing

  8. 핑백: Earn Fast Cash Now

  9. 핑백: eliquids

  10. 핑백: nằm mơ thấy con cóc

  11. 핑백: nằm mơ thấy rắn hổ mang

  12. 핑백: 먹튀검증방법

  13. 핑백: cung thiên bình hợp với cung nào

  14. Hi! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no back up. Do you have any methods to prevent hackers?

  15. I’ve been surfing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my opinion, if all website owners and bloggers made good content as you did, the net will be much more useful than ever before.

  16. I simply want to mention I’m beginner to blogging and site-building and seriously loved this blog site. More than likely I’m want to bookmark your website . You definitely have fantastic writings. Bless you for sharing with us your website.

  17. Pretty nice post. I just stumbled upon your weblog and wanted to mention that I’ve really enjoyed browsing your weblog posts. After all I will be subscribing in your feed and I’m hoping you write once more very soon!

  18. I have been surfing online greater than 3 hours lately, but I never found any fascinating article like yours. It’s beautiful value sufficient for me. In my view, if all website owners and bloggers made just right content material as you probably did, the net shall be much more useful than ever before. “I think that maybe if women and children were in charge we would get somewhere.” by James Grover Thurber.

  19. I just want to say I am newbie to weblog and certainly loved you’re page. Almost certainly I’m going to bookmark your site . You really come with good stories. Thanks a bunch for sharing with us your web-site.

  20. Thanks for the strategies presented. One thing I additionally believe is always that credit cards offering a 0 rate of interest often lure consumers together with zero interest, instant approval and easy online balance transfers, nonetheless beware of the real factor that can void your own 0 easy neighborhood annual percentage rate and also throw anybody out into the terrible house in no time.

  21. I discovered your website website online and check many of your early posts. Keep in the top notch operate. I simply additional increase RSS feed to my MSN News Reader. Looking for forward to reading far more by you at a later date!…

  22. Youre so cool! I dont suppose Ive read anything in this way before. So nice to find somebody with a few original applying for grants this subject. realy appreciate starting this up. this excellent website is something that is required on the net, a person with some originality. helpful work for bringing something totally new on the world wide web!

  23. I simply wanted to compose a small word in order to express gratitude to you for these precious hints you are sharing at this site. My time consuming internet research has now been rewarded with good concept to write about with my visitors. I ‘d repeat that many of us readers are very endowed to live in a good community with so many perfect professionals with interesting points. I feel truly grateful to have encountered your entire website page and look forward to some more excellent moments reading here. Thanks once again for all the details.

  24. Oh my goodness! an amazing post dude. Many thanks Even so We’re experiencing problem with ur rss . Do not know why Unable to subscribe to it. Will there be anybody acquiring identical rss issue? Anybody who knows kindly respond. Thnkx

  25. “My wife and i have been quite thrilled that Peter could deal with his researching via the precious recommendations he grabbed from your web site. It’s not at all simplistic to just possibly be giving for free facts which some people have been trying to sell. Therefore we consider we need the blog owner to appreciate for this. The main illustrations you made, the simple blog menu, the friendships your site help to instill – it’s got mostly astounding, and it’s really aiding our son in addition to the family recognize that this idea is brilliant, which is extraordinarily indispensable. Thank you for all!”

  26. 핑백: mơ rụng tóc đánh con gì

  27. Simply want to say your article is as amazing. The clarity in your post is simply great and that i could assume you are a professional in this subject. Well along with your permission allow me to snatch your RSS feed to keep updated with drawing close post. Thanks one million and please carry on the enjoyable work.

  28. What i don’t realize is actually how you’re not really much more well-liked than you might be now. You’re so intelligent. You realize therefore significantly relating to this subject, made me personally consider it from so many varied angles. Its like women and men aren’t fascinated unless it’s one thing to do with Lady gaga! Your own stuffs nice. Always maintain it up!

  29. I just couldn’t depart your website prior to suggesting that I extremely enjoyed the usual information a person provide for your visitors? Is gonna be again regularly in order to check out new posts

  30. Usually I don’t learn article on blogs, however I wish to say that this write-up very pressured me to check out and do it! Your writing style has been amazed me. Thank you, very nice article.

  31. When I originally left a comment I appear to have clicked the -Notify me when new comments are added- checkbox and now every time a comment is added I receive four emails with the same comment. Perhaps there is a means you can remove me from that service? Kudos.

  32. I have not checked in here for some time because I thought it was getting boring, but the last several posts are great quality so I guess I will add you back to my daily bloglist. You deserve it my friend 🙂

  33. One more issue is really that video gaming has become one of the all-time largest forms of recreation for people of various age groups. Kids participate in video games, and also adults do, too. The particular XBox 360 is just about the favorite gaming systems for individuals that love to have hundreds of video games available to them, and also who like to learn live with people all over the world. Thank you for sharing your notions.

  34. A motivating discussion is worth comment. I believe that you should publish more about this issue, it might not be a taboo subject but generally people don’t discuss such topics. To the next! All the best!

  35. I seriously love your website.. Very nice colors & theme. Did you develop this site yourself? Please reply back as I’m attempting to create my own blog and want to find out where you got this from or what the theme is named. Appreciate it!

  36. What I wouldnt give to have a debate with you about this. You just say so many things that come from nowhere that Im fairly certain Id have a fair shot. Your blog is wonderful visually, I mean people wont be bored. But others who can see past the videos and the layout wont be so impressed with your generic understanding of this topic.

  37. I like what you guys are up too. Such smart work and reporting! Carry on the superb works guys I have incorporated you guys to my blogroll. I think it’ll improve the value of my web site

  38. Hi there! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no data backup. Do you have any methods to stop hackers?

  39. Pretty nice post. I just stumbled upon your weblog and wanted to say that I’ve truly enjoyed surfing around your blog posts. In any case I’ll be subscribing to your rss feed and I hope you write again soon.

  40. I cherished as much as you’ll obtain performed proper here. The sketch is tasteful, your authored subject matter stylish. however, you command get bought an impatience over that you want be delivering the following. in poor health indisputably come more in the past once more since precisely the similar just about very steadily within case you protect this increase.

  41. After I originally commented I clicked the -Notify me when new feedback are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any approach you may take away me from that service? Thanks!

  42. I must say, as a lot as I enjoyed reading what you had to say, I couldnt help but lose interest after a while. Its as if you had a wonderful grasp on the subject matter, but you forgot to include your readers. Perhaps you should think about this from far more than one angle. Or maybe you shouldnt generalise so considerably. Its better if you think about what others may have to say instead of just going for a gut reaction to the subject. Think about adjusting your own believed process and giving others who may read this the benefit of the doubt.Jobs offered

  43. The very next time I read a blog, I hope that it doesn’t fail me just as much as this particular one. After all, I know it was my choice to read, nonetheless I really thought you’d have something useful to talk about. All I hear is a bunch of moaning about something that you could fix if you were not too busy looking for attention.

댓글 남기기