{"id":420,"date":"2021-11-11T11:27:18","date_gmt":"2021-11-11T11:27:18","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/?page_id=420"},"modified":"2021-11-16T12:11:48","modified_gmt":"2021-11-16T12:11:48","slug":"wildcards","status":"publish","type":"page","link":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/higher\/wildcards\/","title":{"rendered":"Wildcards"},"content":{"rendered":"<p>The &#8220;=&#8221; operator is used to find exact matches for text fields, including capitalisation:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">WHERE surname = 'Johnson'<\/pre>\n<p>The LIKE operator can also be used to find exact matchs, but capitalisation is ignored:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">WHERE surname LIKE 'johnson'<\/pre>\n<p>The main purpose of the LIKE operator is to allow use of <strong>wildcards, <\/strong>where only parts of the string pattern are specified.<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center\"><strong>SQL<\/strong><\/td>\n<td style=\"text-align: center\"><strong>MS Access<\/strong><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">\n<pre><strong>&amp;<\/strong><\/pre>\n<\/td>\n<td style=\"text-align: center\">\n<pre><strong>*<\/strong><\/pre>\n<\/td>\n<td><strong>matches zero, one or many characters<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">\n<pre><strong>_<\/strong><\/pre>\n<\/td>\n<td style=\"text-align: center\">\n<pre><strong>?<\/strong><\/pre>\n<\/td>\n<td><strong>matches a single character<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Examples:<\/p>\n<pre class=\"brush: sql; highlight: [2]; title: ; notranslate\" title=\"\">-- Match surnames that start with 'Thom'\r\nWHERE surname LIKE 'Thom%'<\/pre>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">-- Match surnames that end with 'son'\r\nWHERE surname LIKE '%son'<\/pre>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">-- Match surnames that start with 'Thom' and end with 'son'\r\nWHERE surname LIKE 'Thom%son'<\/pre>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">-- Match surnames contain 'is' anywhere\r\nWHERE surname LIKE '%is%'<\/pre>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">-- Match surnames that have 'H' as the second letter\r\nWHERE surname LIKE '_h%'<\/pre>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">-- Match surnames that start with ;m; and have at least three characters\r\nWHERE surname LIKE 'm_%_%'\r\n <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The &#8220;=&#8221; operator is used to find exact matches for text fields, including capitalisation: WHERE surname = &#8216;Johnson&#8217; The LIKE operator can also be used to find exact matchs, but capitalisation is ignored: WHERE surname LIKE &#8216;johnson&#8217; The main purpose of the LIKE operator is to allow use of wildcards, where only parts of the string pattern are specified. SQL MS Access &amp; * matches zero, one or many characters<\/p>\n<p><a class=\"more-link\" href=\"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/higher\/wildcards\/\">Read More<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"parent":417,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-420","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/pages\/420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/comments?post=420"}],"version-history":[{"count":7,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/pages\/420\/revisions"}],"predecessor-version":[{"id":483,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/pages\/420\/revisions\/483"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/pages\/417"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/sh\/ahscomputingsql\/wp-json\/wp\/v2\/media?parent=420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}