Null and Blank values in MySQL - MySQL Developer Tutorial

Null and Blank values in MySQL

Null is absence of value. The blank is value that is empty string. Let's say if we need to create customer table with different columns. There is possibility that sometime we don't have any last name. So we will leave the column without inserting any value, As we are not inserting any value in last name then it will have null ( Absence of value). 

There could be scenarios when you will insert the value but blank. Let's create our table and then insert leave few column value as Null and insert some blank values.


CREATE TABLE `customer` (
  `firstname` varchar(50)  NULL,
  `lastname` varchar(30)  NULL,
  `age` int(11) DEFAULT NULL,
  `phonenumber` char(11) DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `gender` char(1) NOT NULL
) ;


Let's insert some values in customer table.

insert into customer(idcustomer,firstname,lastname,age,phonenumber,dob,gender)
values
(1,'Aamir','Ali',39,'505-4141969','1980-01-01','M'),
(2,'Aamir','Naz',39,'505-4141969','1980-01-01','M'),
(3,'Bob',Null,59,'505-4141969','1980-01-01','M'),
(4,'Robert','',59,'505-4141969','1980-01-01','M'),
(5,'Lisa','   ',59,'505-4141969','1980-01-01','M');

Now if you want to get the records from customer table which don't have value (absent of value) in lastname column. you can use below query.

select * from customer where lastname is NULL;


If we need to find all the rows which has blank value in lastname column, and you can see in our insert statement we have blank values which is equal to '' or '  ' or more blank spaces.

We can use ltrim and rtrim to trim to single blank space to compare and get all the records.

select * from customer 
where Rtrim(ltrim(lastname))='';





97 comments:

  1. They're produced by the very best degree developers who will be distinguished for your polo dress creating. You'll find polo Ron Lauren inside exclusive array which include particular classes for men, women.
    artificial intelligence course in india

    ReplyDelete
  2. There are such a large number of kinds of articles accessible. I extremely get a kick out of the chance to read the one which you have partaken in this post. Each article has novel and particular characteristics to its write. We can see some same characters in all articles. Writers motivate opportunity to share imperative and convincing data by inquiring about and framing writing thought and altering work to the readers. You have completed an incredible work. I truly making the most of your posts. Refer best essay writing service to get any help in writing.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting SQL server DBA certification

    ReplyDelete
  5. I am looking for SQL commands and this will be very helpful for me to learn more about table insertion.

    Digital marketing

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Nice! thank you so much! Thank you for sharing. Your blog posts are more interesting and informative. I think there are many people like and visit it regularly, including me. Digital Marketing Institute in Delhi | Digital Marketing Training in Delhi | Digital Marketing Training Institute in Delhi | Best Digital Marketing Institute in Delhi | Best Digital Marketing Course in Delhi

    ReplyDelete
  8. I am thankful to this blog for assisting me. I added some specified clues which are really important for me to use them in my writing skill. Really helpful stuff made by this blog. Voip service

    ReplyDelete
  9. Thanks for sharing information.We also offer packers and movers in miyapur, Hyderabad and across all towns and cities in India.

    ReplyDelete
  10. You're the best for taking the time and composing this post. This post truly helped me to find out about this subject. Great post. On the off chance that you need you can visit my site to find out about style fit for lords (and, obviously, the sovereigns) and other such huge numbers of tips for better, cool, the kitschy item under the rainbow. thanks for sharing this comment.
    technology news pakistan

    ReplyDelete
  11. Thank you so much for this wonderful Post. This is an awesome post thank you for sharing this interesting post.

    7 tips to start a career in digital marketing

    “Digital marketing is the marketing of product or service using digital technologies, mainly on the Internet, but also including mobile phones, display advertising, and any other digital medium”. This is the definition that you would get when you search for the term “Digital marketing” in google. Let’s give out a simpler explanation by saying, “the form of marketing, using the internet and technologies like phones, computer etc”.

    we have offered to the advanced syllabus course digital marketing for available join now

    more details click the link now

    https://www.webdschool.com/digital-marketing-course-in-chennai.html

    ReplyDelete
  12. Thank for this blog are more informative step by step and useful contents. I here by attached my site would you see this blog.

    Web designing trends in 2020

    When we look into the trends, everything which is ruling today’s world was once a start up and slowly begun getting into. But Now they have literally transformed our lives on a tremendous note. To name a few, Facebook, Whats App, Twitter can be a promising proof for such a transformation and have a true impact on the digital world.

    we have offered to the advanced syllabus course web design and development for available join now

    more details click the link

    https://www.webdschool.com/web-development-course-in-chennai.html

    ReplyDelete
  13. If you are stuck with your Law assignment then in this case you can opt for our Law Assignment Help. we provide the bestLaw homework writing service UK.We also provideBusiness Law Homework Help for students across the globe. for more information contact us +16692714848.

    ReplyDelete
  14. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. Avenue South Residence

    ReplyDelete
  15. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. Avenue South Residence

    ReplyDelete
  16. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. The Avenir

    ReplyDelete
  17. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. The Avenir

    ReplyDelete
  18. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. midtown modern condo

    ReplyDelete
  19. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. midtown modern condo

    ReplyDelete
  20. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. myra condo

    ReplyDelete
  21. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. myra condo

    ReplyDelete
  22. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. One Pearl Bank

    ReplyDelete
  23. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. One Pearl Bank

    ReplyDelete
  24. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. Hyll On Holland

    ReplyDelete
  25. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. Hyll On Holland

    ReplyDelete
  26. That's wonderful information!!!
    UK VPS Server Hosting

    ReplyDelete
  27. I finally found great post here.I will get back here. I just added your blog to my bookmark sites. thanks.Quality posts is the crucial to invite the visitors to visit the web page, that's what this web page is providing.
    artificial intelligence course in bangalore

    ReplyDelete
  28. These mysql queries really helped us in our project. Thanks for this nice blog.
    Thanks
    Mereint Infotech
    https://merientinfotech.com/

    ReplyDelete
  29. I feel SSIS is a very important component which actually helps in solving of many complex IT problems and facts.

    SSIS Upsert

    ReplyDelete
  30. Search for the best offers and collect discounts from the top stores all over the UK. Exclusive Discount Voucher Codes
    Vouchers Codes

    ReplyDelete
  31. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks! A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article.
    Web Development Company Australia

    ReplyDelete
  32. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. freelance sites like fiverr

    ReplyDelete
  33. Newly informative post. All about this post is something new info. mattress for kids

    ReplyDelete
  34. Thank you for sharing. If you are interested in purchasing Madden 21 Coins, you are welcome to visit GameMS.

    ReplyDelete
  35. That's a beautiful post regarding "Null and Blank values in MySQL". I can't wait to utilize the resources you've shared with us. Do share more such informative posts. For more information regarding SEO and Digital Marketing Services Visit Digital Shout We provide marketing services to start-up's and small businesses looking for a partner for their digital media. We work with you, not for you. We are on a mission to build, grow, and maintain loyal communities.

    ReplyDelete
  36. They screen and track the business drifts, contender's systems, check for the focused on watchwords - all which are expected to improve the natural query output postings of your customer's site. SEO Antwerpen

    ReplyDelete
  37. Nice post, I like to read this blog. It is very interesting to read.
    fibonacci in python
    python class inheritance

    ReplyDelete
  38. this information So i am glad to www.offshoreservers.net
    show that I have a very excellent uncanny feeling
    I discovered just what I needed.

    ReplyDelete
  39. Get beautiful and sexy Call girl in Jaipur to pleasure your desire by just calling a number. For more information visit the website.

    ReplyDelete
  40. Courier Service in Noida you can likewise follow the advancement of your conveyance utilizing our web-based following device, and even get affirmation that it has been endorsed for at its objective, on the off chance that you need it.

    ReplyDelete
  41. Best Aerial Yoga Classes in Noida for Ashtanga,Iyengar Yoga,YOGA POSES,PILATES,DANCE MOVES body & mind. Learn correct Surya namaskar, pranayam, hatha yoga. Busy with work? Get AERIAL Yoga trainer and workout from the comfort of your home.more for information visit our website.

    ReplyDelete
  42. Candidates who want to immigrate to Australia to make their career in ICT or a related field with non ICT degree or insufficient ICT qualification are required to submit the RPL project report along with an employment reference letter to the Australian Computer Society (ACS) to display your competency according to the standard set by ACS and get positively assessed in RPL ACS skilled assessment Australia.

    ReplyDelete
  43. It might be extremely useful and Honey well Gent Fire alarm system Pakistan useful for me and my friends.

    ReplyDelete
  44. jaipur escort is available throughout the city. If you ever visit Jaipur for any reason, like a business trip or with friends, visit Jaipur escort. For experiencing a new world full of happiness and joy, Jaipur escort is the only option you will ever choose. If you are worried about your privacy, stay relaxed. The call girls will keep all your confidential matters a secret and in complete privacy. We provide our customers with stylish, hot, independent and charming partners.

    ReplyDelete
  45. Mbbs in Kazakhstan is the best place to pursue mbbs abroad countries. It is mainly for the students who are quite serious about fulfilling their dream of becoming a doctor. The most important thing about this is that you don't have to pay a high cost to take admission to the top universities of Kazakhstan. When you compare the college fees of Indian colleges with the top colleges of Kazakhstan, you will find that Indian college fees are much higher when compared to the fee structure of top colleges of Kazakhstan.

    ReplyDelete
  46. Escorts in Sindhi camp offer the most beautiful, stylish and sexy models to all the customers for escort services. Sindhi camp escort is the best and the most beautiful place to visit for sexual favors. So, at Jaipur escorts service, you will get the most attractive models to have fun at a cheaper rate.

    ReplyDelete
  47. Real estate developer plays a significant role in the construction industry as they create a gap between the construction ability and requirements of the investors. They cater to the needs of the projects based on the design, cost, and location of the construction. Reaching the right real estate developers helps you in getting the worthwhile 3 bhk flats in indirapuram. Apart from this, they very well understand the international trends and recognize the customer needs.

    ReplyDelete
  48. The blog written is extremely impressive, with a great topic. However, a bit more research could have strengthened it even further. You can explore the services as offered by essaycorp.com, a premium academic writing services platform offering the best gantt chart assignment with knowledge and experience.
    permutation assignment
    data analysis assignment
    USA assignment
    UK assignment

    ReplyDelete
  49. This comment has been removed by the author.

    ReplyDelete
  50. When you are looking for the ACS Approved Rpl Samples, you always need samples approved by the ACS and are as per the ACS guidelines. Considering this rplforaustralia has provided the Acs Approved Rpl Samples with these given samples, candidates can easily prepare their RPL report to get eligible for the Australia Skilled Migration. At rplforaustralia, you ACS RPL sample with the two projects and the important key points required for the Australian immigration.

    ReplyDelete
  51. The fully automated testing lab in Agra is licensed to perform more tests, which is self and the most satisfying part is each test cost less. It also has improved how laboratories work, especially in the clinical area. However, at the same time, it has built a dispute as to how labs look at themselves, what tests they give, and how their team has been extended.

    ReplyDelete
  52. I appreciate to your blog because this BLOG is different according to other Blogging.
    quickbooks phone number

    ReplyDelete


  53. however users had faced some major issues while operating the software. Issues related to installing, updating and downloading company files. To get easy recovery for such issues, immediately connect with our team at QuickBooks Customer Service here you will end up getting gratifying services.
    Quickbooks Customer Service

    ReplyDelete
  54. These errors can cause a serious issue in your work. To eliminate these errors, connect with our team at Quickbooks Phone Number.

    ReplyDelete
  55. call us on QuickBooks Phone Number 1866-822-4745 and get effective ways to mend QuickBooks problems.
    Quickbooks Phone Number

    ReplyDelete
  56. Quickbooks:Obtain high-quality service for QuickBooks on Quickbooks Phone Number 1866-447-5478.
    Quickbooks Phone Number

    ReplyDelete
  57. Buy 2 BHK & 3 BHK flats at an Affordable flats in Ghaziabad SVP Group brings you new flats in Krishan Vihar, Pratap Vihar, close to NH-24 in the hearts of Ghaziabad.

    ReplyDelete
  58. Here you can experience the best customer service team who help you with your tax and accounting services.
    Quickbooks Phone Number 1 888-932-7932.

    ReplyDelete
  59. Relish the best support service for QuickBooks on QuickBooks Phone Number quickbooks customer service number 1 855-738-7873.

    ReplyDelete
  60. Quickbooks Phone Number 1 877-693-1117 make sure to assist you with the most suitable support service for QuickBooks. Our team never leaves any stone unturned when it comes to delivering the best service.

    ReplyDelete
  61. Need a solution for QuickBooks error. Get in touch on our Quickbooks Phone Number (877)-754-1114 and get a resolution within 24 hours.

    ReplyDelete
  62. QuickBooks the simplest, cheapest accounting software that has made accounting life easier and when it itself gets in trouble then we have a team of experts to help you resolve issues with QuickBooks. You can also feel free to contact us if you have any queries or need assistance in resolving the issue.
    QuickBooks expert (855) 377-7767

    ReplyDelete
  63. Their services are free of cost, so there is no need to worry about the financial burden on your end. They also offer additional services like annual maintenance and support for QuickBooks products.You can rely on their expertise and get all your queries answered by phone or email.
    Quickbooks Phone Number (877) 762-1118

    ReplyDelete
  64. Thanks for sharing such informative Information. It is really helpful for me and I get my lots of solution with this blog. For more interesting information I bookmark this and I hope your next article comes soon. I am also a blogger, you can follow my blog here Real Estate Mobile App Development

    ReplyDelete
  65. This comment has been removed by the author.

    ReplyDelete
  66. This article has suggested many new ideas. Hope you can continue to contribute your talents in this field. myassignmenthelp

    ReplyDelete

  67. Hi there!

    That's a very nice article and blog, I found it informative and useful, hope to read more nice posts like this one around here,

    Keep sharing the best content,

    Your follower

    Salvatore from Visite as Foz do Iguaçu e Conheça as Cataratas do Iguaçu Compre Agora seus Ingressos Online

    ReplyDelete
  68. Great Post!!! thanks for sharing this information with us.
    what is .net development
    dot net technology

    ReplyDelete
  69. Eccentric occur when body muscles lengthen, while moving or lifting downward. Muscles are stronger at eccentric phase reason being that, at this phase body can handle more weight load than concentric phase
    theology assignment help
    assignment help
    computer science assignment help
    capstone project help online
    article writer
    content writer for hire
    content writing services online
    freelance writer for hire
    ghost writer for hire online
    write my assignments for me

    ReplyDelete
  70. At British Dissertation Help, we work hard to fulfill our mission of assisting the students with only the top-notch computer science assignments. Our 360-degree Computer Science Assignment Help have satisfied countless students and enabled them to obtain top grades for academic excellence at undergraduate, postgraduate, and doctorate levels.

    ReplyDelete
  71. Writer's block used to be my constant nemesis until I found English Assignment Help. Their tutors have a knack for inspiring creativity and helping me break through mental barriers. Whenever I feel stuck, I know I can count on their valuable guidance to get my ideas flowing again.

    ReplyDelete
  72. incredibly informative tech-related posts. I am constantly amazed by the up to date insights you share.

    Our mission is to help students academically by catering english assignment help. whether it's analyzing literature, writing essays, ur team of experienced and knowledgeable tutors is ready to assist you every step of the way.

    ReplyDelete