{"id":12412,"date":"2019-12-10T12:18:22","date_gmt":"2019-12-10T12:18:22","guid":{"rendered":"https:\/\/ittutorial.org\/?p=12412"},"modified":"2019-12-14T17:25:21","modified_gmt":"2019-12-14T17:25:21","slug":"oracle-introduction-to-sql-tutorial-3","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/oracle-introduction-to-sql-tutorial-3\/","title":{"rendered":"Oracle Introduction to SQL Tutorial &#8211; 3"},"content":{"rendered":"<p>Hi everyone, In this article we will examine Functions.<\/p>\n<p>In SQL Language, instead of repeating the same tasks, writing these functions as functions saves you time and makes your queries run more efficiently.<\/p>\n<p>I will go through the example without explaining in detail what the functions mean.\u00a0 Thus, it will be more understandable to explain by example.<\/p>\n<p>&nbsp;<\/p>\n<h3>Lower Function<\/h3>\n<p>Converts letters in SQL Query to lowercase.<\/p>\n<pre>SELECT LOWER(PROD_NAME) FROM SH.PRODUCTS;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12417\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-5.png\" alt=\"\" width=\"775\" height=\"724\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-5.png 775w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-5-300x280.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_1-5-768x717.png 768w\" sizes=\"auto, (max-width: 775px) 100vw, 775px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Upper Function<\/h3>\n<p>Converts letters in SQL Query to uppercase.<\/p>\n<pre>SELECT UPPER(PROD_NAME) FROM SH.PRODUCTS;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12421\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-5.png\" alt=\"\" width=\"1038\" height=\"648\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-5.png 1038w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-5-300x187.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-5-768x479.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_2-5-1024x639.png 1024w\" sizes=\"auto, (max-width: 1038px) 100vw, 1038px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Initcap Function<\/h3>\n<p>Converts only the first letters of the columns in the SQL Query to uppercase.<\/p>\n<pre>SELECT Initcap(PROD_NAME) FROM SH.PRODUCTS;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12422\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_3-5.png\" alt=\"\" width=\"882\" height=\"659\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_3-5.png 882w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_3-5-300x224.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_3-5-768x574.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Concat Function<\/h3>\n<p>Used to concatenate strings within the SQL Query.<\/p>\n<pre>SELECT CONCAT(CUST_FIRST_NAME,CUST_LAST_NAME) FROM SH.CUSTOMERS;<\/pre>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12424\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-5.png\" alt=\"\" width=\"916\" height=\"624\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-5.png 916w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-5-300x204.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-5-768x523.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_4-5-130x90.png 130w\" sizes=\"auto, (max-width: 916px) 100vw, 916px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Length Function<\/h3>\n<p>Returns the number of characters returned by the SQL Query result.<\/p>\n<pre>SELECT CUST_FIRST_NAME, LENGTH(CUST_FIRST_NAME) FROM SH.CUSTOMERS;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12427\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-4.png\" alt=\"\" width=\"847\" height=\"588\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-4.png 847w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-4-300x208.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-4-768x533.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-4-392x272.png 392w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_5-4-130x90.png 130w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Lpad Function<\/h3>\n<p>It allows you to add any number of desired characters from left to right in the result of SQL query.<\/p>\n<p><strong>Use of:\u00a0<\/strong><span style=\"color: #0000ff\">SELECT LPAD (Column name, &lt;Number to add&gt;, &#8216;&lt;Characters to add&gt;&#8217;) from table_name;<\/span><\/p>\n<pre><span style=\"color: #000000\">SELECT LPAD(CUST_FIRST_NAME,10,'*') FROM SH.CUSTOMER;<\/span><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12429\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-2.png\" alt=\"\" width=\"784\" height=\"483\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-2.png 784w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-2-300x185.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_6-2-768x473.png 768w\" sizes=\"auto, (max-width: 784px) 100vw, 784px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Added &#8216;*&#8217; from left to right, totaling 10 characters as shown in the picture. You can use the <strong>rpad()<\/strong> function to insert from right to left.<\/p>\n<p>&nbsp;<\/p>\n<h3>Translate Function<\/h3>\n<p>As a result of the SQL query written, it converts the desired character in the desired column to the desired character.<\/p>\n<p><strong>Sample usage: <\/strong>SELECT Translate (&lt;column name&gt;, &#8216;&lt;Character to change&gt;&#8217;,'&lt;New character&gt;&#8217; ) from table name;<\/p>\n<pre>select cust_first_name from sh.customers;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12430\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_7-2.png\" alt=\"\" width=\"856\" height=\"572\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_7-2.png 856w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_7-2-300x200.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_7-2-768x513.png 768w\" sizes=\"auto, (max-width: 856px) 100vw, 856px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Now let&#8217;s replace the letter &#8216;A&#8217; with &#8216;F&#8217;.<\/p>\n<pre>select translate(cust_first_name,'A','F') from SH.CUSTOMERS;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12431\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_8-2.png\" alt=\"\" width=\"828\" height=\"247\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_8-2.png 828w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_8-2-300x89.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/Screenshot_8-2-768x229.png 768w\" sizes=\"auto, (max-width: 828px) 100vw, 828px\" \/><\/p>\n<p>&nbsp;<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"0dTxKd5UN8\"><p><a href=\"https:\/\/ittutorial.org\/oracle-introduction-to-sql-tutorial-2\/\">Oracle Introduction to SQL Tutorial &#8211; 2<\/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 Tutorial &#8211; 2&#8221; &#8212; IT Tutorial\" src=\"https:\/\/ittutorial.org\/oracle-introduction-to-sql-tutorial-2\/embed\/#?secret=SzN4xojT3w#?secret=0dTxKd5UN8\" data-secret=\"0dTxKd5UN8\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi everyone, In this article we will examine Functions. In SQL Language, instead of repeating the same tasks, writing these functions as functions saves you time and makes your queries run more efficiently. I will go through the example without explaining in detail what the functions mean.\u00a0 Thus, it will be more understandable to explain &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-12412","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\/12412","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=12412"}],"version-history":[{"count":3,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/12412\/revisions"}],"predecessor-version":[{"id":13305,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/12412\/revisions\/13305"}],"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=12412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=12412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=12412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}