{"id":12391,"date":"2019-12-10T12:16:55","date_gmt":"2019-12-10T12:16:55","guid":{"rendered":"https:\/\/ittutorial.org\/?p=12391"},"modified":"2019-12-14T17:25:49","modified_gmt":"2019-12-14T17:25:49","slug":"oracle-introduction-to-sql-tutorial-2","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/oracle-introduction-to-sql-tutorial-2\/","title":{"rendered":"Oracle Introduction to SQL Tutorial &#8211; 2"},"content":{"rendered":"<div class=\"ittut-before-content\" style=\"margin-left: auto;margin-right: auto;text-align: center;\" id=\"ittut-1853563191\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-3373538331699715\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-3373538331699715\" \ndata-ad-slot=\"1119430155\" \ndata-ad-format=\"auto\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div><p>Hi everyone, In this article, we will examine the conditional clause &#8220;WHERE&#8221; and logical operators.<\/p>\n<p>In the SQL language, if you want to show the output of the SQL command according to a certain condition, the &#8220;WHERE&#8221; command will be useful.<\/p>\n<ul>\n<li>Strings and date values must be enclosed in single quotes.<\/li>\n<li>The clauses must follow the table name in accordance with the hierarchy.<\/li>\n<\/ul>\n<p>Let&#8217;s try to understand better with the example,<\/p>\n<pre>SELECT * FROM HR.employees WHERE salary &gt;4000;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12392\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-4.png\" alt=\"\" width=\"1110\" height=\"582\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-4.png 1110w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-4-300x157.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-4-768x403.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-4-1024x537.png 1024w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-4-390x205.png 390w\" sizes=\"auto, (max-width: 1110px) 100vw, 1110px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>We have called a query to return values greater than 4000 for the &#8220;SALARY&#8221; column.<\/p><div class=\"ittut-content\" id=\"ittut-2333413392\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-3373538331699715\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-3373538331699715\" \ndata-ad-slot=\"1119430155\" \ndata-ad-format=\"auto\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>\n<p>If the condition statement will be more than one, each condition statement must be accompanied by &#8220;<strong>AND<\/strong>&#8220;, &#8220;<strong>OR<\/strong>&#8221; commands.<\/p>\n<pre>SELECT * FROM HR.employees WHERE salary &gt;4000 AND FIRST_NAME ='David';<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12395\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-4.png\" alt=\"\" width=\"1059\" height=\"301\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-4.png 1059w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-4-300x85.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-4-768x218.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-4-1024x291.png 1024w\" sizes=\"auto, (max-width: 1059px) 100vw, 1059px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><\/h3>\n<p>Let&#8217;s continue with a different example,<\/p>\n<pre>SELECT * FROM HR.employees WHERE SALARY&gt;=10000 ORDER BY SALARY;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12398\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_3-4.png\" alt=\"\" width=\"1020\" height=\"627\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_3-4.png 1020w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_3-4-300x184.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_3-4-768x472.png 768w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>The &#8220;SALARY&#8221; value is 10000 and we brought the larger ones.<\/p>\n<p>In the next example let&#8217;s specify a range, Important keyword &#8220;BETWEEN&#8221;.<\/p>\n<pre>SELECT * FROM HR.employees WHERE SALARY <strong>BETWEEN<\/strong> 10000 AND 14000;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12399\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-4.png\" alt=\"\" width=\"1038\" height=\"568\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-4.png 1038w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-4-300x164.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-4-768x420.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-4-1024x560.png 1024w\" sizes=\"auto, (max-width: 1038px) 100vw, 1038px\" \/><\/p>\n<p>One of the important issues is the &#8220;<strong>like<\/strong>&#8221; operator.\u00a0 The &#8220;like&#8221; operator is used to find strings that match a given template.<\/p>\n<ul>\n<li>It can contain a conditional sentence and \/ or a number.<\/li>\n<li>&#8220;%&#8221; contains zero or more characters<\/li>\n<li>The special character &#8220;_&#8221; represents exactly one character.<\/li>\n<\/ul>\n<p>We&#8217;ve questioned names starting with &#8220;J&#8221;.<\/p>\n<pre>SELECT * FROM HR.employees WHERE FIRST_NAME like 'J%';<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12400\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-3.png\" alt=\"\" width=\"1105\" height=\"541\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-3.png 1105w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-3-300x147.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-3-768x376.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-3-1024x501.png 1024w\" sizes=\"auto, (max-width: 1105px) 100vw, 1105px\" \/><\/p>\n<p>Let&#8217;s question the names with &#8220;ald&#8221; in it.<\/p>\n<pre>SELECT * FROM HR.employees WHERE FIRST_NAME like '%ald';<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12401\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-1.png\" alt=\"\" width=\"1040\" height=\"259\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-1.png 1040w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-1-300x75.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-1-768x191.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-1-1024x255.png 1024w\" sizes=\"auto, (max-width: 1040px) 100vw, 1040px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Logical Operators<\/h3>\n<p>If we want to make comparisons in SQL Language according to multiple criteria, we need to do this using logical operators.<\/p>\n<ul>\n<li><span style=\"color: #339966\">AND<\/span><\/li>\n<li><span style=\"color: #339966\">OR<\/span><\/li>\n<li><span style=\"color: #339966\">NOT<\/span><\/li>\n<\/ul>\n<p>The AND operator returns true if both conditions are true.<\/p>\n<p>Get records with the name &#8220;William&#8221; <strong>and<\/strong> the surname &#8220;Gietz&#8221;,<\/p>\n<pre>SELECT * FROM HR.employees WHERE FIRST_NAME='William' AND LAST_NAME='Gietz';<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12402\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_7-1.png\" alt=\"\" width=\"951\" height=\"235\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_7-1.png 951w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_7-1-300x74.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_7-1-768x190.png 768w\" sizes=\"auto, (max-width: 951px) 100vw, 951px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>The OR operator, whether the query result can return true depends on whether at least one of the given conditions is true.<\/p>\n<p>Let&#8217;s see the records with the name &#8220;Susan&#8221; or Salary 17000.<\/p>\n<pre>SELECT * FROM HR.employees WHERE FIRST_NAME='Susan' OR SALARY=17000;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12406\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_8-1.png\" alt=\"\" width=\"980\" height=\"277\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_8-1.png 980w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_8-1-300x85.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_8-1-768x217.png 768w\" sizes=\"auto, (max-width: 980px) 100vw, 980px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>The NOT operator allows us to retrieve values other than those specified in the query result list,<\/p>\n<pre>SELECT * FROM HR.employees WHERE SALARY NOT IN (3000,5000,10000);<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12408\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_9-1.png\" alt=\"\" width=\"1091\" height=\"619\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_9-1.png 1091w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_9-1-300x170.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_9-1-768x436.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_9-1-1024x581.png 1024w\" sizes=\"auto, (max-width: 1091px) 100vw, 1091px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>As can be seen from the result, we brought 3000, 5000 and 10000 non-salaries.<\/p>\n<p>See you in next article..<\/p>\n<p>&nbsp;<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"ZPHOsiEqDh\"><p><a href=\"https:\/\/ittutorial.org\/oracle-introduction-to-sql-1\/\">Oracle Introduction to SQL &#8211; 1<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Oracle Introduction to SQL &#8211; 1&#8221; &#8212; IT Tutorial\" src=\"https:\/\/ittutorial.org\/oracle-introduction-to-sql-1\/embed\/#?secret=RnaS4zu1XA#?secret=ZPHOsiEqDh\" data-secret=\"ZPHOsiEqDh\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<div class=\"ittut-after-content\" id=\"ittut-2431261024\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-3373538331699715\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-3373538331699715\" \ndata-ad-slot=\"1119430155\" \ndata-ad-format=\"auto\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Hi everyone, In this article, we will examine the conditional clause &#8220;WHERE&#8221; and logical operators. In the SQL language, if you want to show the output of the SQL command according to a certain condition, the &#8220;WHERE&#8221; command will be useful. Strings and date values must be enclosed in single quotes. The clauses must follow &hellip;<\/p>\n","protected":false},"author":67,"featured_media":12330,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3019],"tags":[4936,4929,4875,4883,4873,4869,4910,1340,4870,4895,4905,4935,4926,4915,4921,4919,4920,4918,4917,3192,4872,4916,4928,4876,4912,4881,4880,4890,4867,3062,4879,4891,4923,4924,4922,4925,4909,4911,4877,4896,4908,4882,4884,4897,4901,4900,4898,4902,4903,4899,4871,3015,3018,4868,4904,4906,4893,4930,4934,4914,4933,4885,4887,4913,3000,4931,4889,4927,4907,4888,4886,4892,4874,4878,4894,4932],"class_list":["post-12391","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-oracle-sql","tag-case-insensetive","tag-create-view","tag-database-nedir","tag-insert-nedir","tag-kolay-sql","tag-mysql-sql","tag-or","tag-oracle-sql","tag-php-sql","tag-plsql","tag-right-outer-join","tag-selecting-multiple-colum","tag-sql-all-drop","tag-sql-all-statements","tag-sql-alter","tag-sql-alter-colum","tag-sql-alter-database","tag-sql-alter-statement","tag-sql-alter-table","tag-sql-and","tag-sql-baslangic-dersleri","tag-sql-creat-table","tag-sql-create-view","tag-sql-database","tag-sql-date-functions","tag-sql-dcl","tag-sql-ddl","tag-sql-delete","tag-sql-dersleri","tag-sql-distinct","tag-sql-dml","tag-sql-dml-nedir","tag-sql-drop-colum","tag-sql-drop-database","tag-sql-drop-statement","tag-sql-drop-table","tag-sql-filtering-data","tag-sql-functions","tag-sql-ifadeleri","tag-sql-ile-ne-yapilir","tag-sql-in-statement","tag-sql-insert","tag-sql-insert-nasil-yapilir","tag-sql-is-ilanlari","tag-sql-join-yapisi","tag-sql-kaynaklari","tag-sql-kullanmak","tag-sql-lef-join","tag-sql-left-outer-join","tag-sql-makaleleri","tag-sql-nasil-ogrenilir","tag-sql-nedir","tag-sql-ogrenme","tag-sql-ogrenmek","tag-sql-right-join","tag-sql-right-outer-join","tag-sql-select-islemi","tag-sql-set-auto-increment","tag-sql-sorting-results","tag-sql-subqueries","tag-sql-syntaxt-rule","tag-sql-tablo-olusturma","tag-sql-tablo-yapisi","tag-sql-to_char-function","tag-sql-tutorial","tag-sql-union-statement","tag-sql-update-islemi","tag-sql-view","tag-sql-where-statement","tag-sql-yapisi","tag-tablo-nedr","tag-tablodan-veri-cekmek","tag-temel-seviye-sql","tag-temel-seviyede-sql","tag-tsql","tag-union-table"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/sql.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/12391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=12391"}],"version-history":[{"count":3,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/12391\/revisions"}],"predecessor-version":[{"id":13304,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/12391\/revisions\/13304"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/12330"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=12391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=12391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=12391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}