{"id":11800,"date":"2019-11-08T16:07:51","date_gmt":"2019-11-08T16:07:51","guid":{"rendered":"https:\/\/ittutorial.org\/?p=11800"},"modified":"2019-11-20T18:07:56","modified_gmt":"2019-11-20T18:07:56","slug":"introduction-to-sql-2","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/introduction-to-sql-2\/","title":{"rendered":"Oracle SQL Tutorial -2 Introduction To Oracle SQL"},"content":{"rendered":"<p align=\"left\"><span style=\"font-size: large\">Hello ,<\/span><\/p>\n<p align=\"left\"><span style=\"font-size: large\"><span lang=\"en-US\">In this article, I will tell you about the expressions that form the basis of sql and how to give aliases to columns.<\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #ce181e\"><span style=\"font-size: large\"><span lang=\"en-US\">NULL EXPRESSION<\/span> <\/span><\/span><\/p>\n<ul>\n<li>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">Null values are unknown , unspecified .<\/span> <\/span><\/span><\/p>\n<\/li>\n<li>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">When null is entered into an arithmetic operation , the result will be null .<\/span> <\/span><\/span><\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-11801\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/1-1-300x91.png\" alt=\"\" width=\"376\" height=\"114\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/1-1-300x91.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/1-1.png 512w\" sizes=\"auto, (max-width: 376px) 100vw, 376px\" \/><\/p>\n<p align=\"left\"><span style=\"color: #ce181e\"><span style=\"font-size: large\"><span lang=\"en-US\">SELECT EXPRESSION<\/span> <\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">With the SELECT statement , we select the columns to use in the table that we select , or if we use all the columns , we select all the columns in the table by using (*) .<\/span><\/span><\/span> <span style=\"font-size: medium\"><span lang=\"en-US\">As an example of its use :<\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\">SELECT kolon_adi FROM tablo_adi or <\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\">SELECT * FROM tablo_adi <\/span><\/span><span style=\"font-size: large\"><span lang=\"en-US\">used in the form .<\/span><\/span><\/p>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-11802\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/2-1-300x99.png\" alt=\"\" width=\"379\" height=\"125\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/2-1-300x99.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/2-1-768x255.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/2-1.png 992w\" sizes=\"auto, (max-width: 379px) 100vw, 379px\" \/><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">Here I have selected all fields with SELECT * in my SH.CUSTOMERS table .<\/span> <\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #ce181e\"><span style=\"font-size: large\"><span lang=\"en-US\">FROM EXPRESSION<\/span> <\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">The From statement specifies our table containing the specified columns .<\/span> <\/span><\/span><\/p>\n<pre><em>SELECT * FROM SH.CUSTOMERS;<\/em><\/pre>\n<p align=\"left\"><span style=\"color: #ce181e\"><span style=\"font-size: large\"><span lang=\"en-US\">WHERE EXPRESSION<\/span> <\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">We use the where statement to restrict the fetch of data, and to bind them to a condition .<\/span><\/span><\/span> <span style=\"font-size: medium\"><span lang=\"en-US\">For example , if we want to see 30-year-old workers in our worker table , we use where .<\/span><\/span><\/p>\n<pre><span style=\"color: #000000\"><span style=\"font-size: large\">SELECT*FROM ADMIN.ISCI WHERE yas=30;<\/span><\/span><\/pre>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\"><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Let&#8217;s make another example .<\/span><\/span><\/span> <\/span><\/span><\/p>\n<pre><em>SELECT * FROM SH.CUSTOMERS WHERE CUST_YEAR_OF_BIRTH &gt; 1964;<\/em><\/pre>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">In this query , we wanted to see those whose birth date is greater than 1964 , and the result of running this query below :<\/span> <\/span><\/span><\/p>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-11805\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/5-1-300x71.png\" alt=\"\" width=\"452\" height=\"107\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/5-1-300x71.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/5-1-768x182.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/5-1.png 967w\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" \/><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">another example<\/span> :<\/span><\/span><\/p>\n<pre><em>SELECT * FROM ADMIN.NEW_TABLE WHERE SALARY &lt; 3000;<\/em><\/pre>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12250\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/where1-300x29.png\" alt=\"\" width=\"580\" height=\"56\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/where1-300x29.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/where1-768x74.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/where1.png 960w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/p>\n<p align=\"left\"><span style=\"color: #ce181e\"><span style=\"font-size: large\"><span lang=\"en-US\">NAMING OF COLUMNS (ALIAS)<\/span> <\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">Nicknames given to columns do not cause any changes in our result set , we only use these names in our sql query .<\/span><\/span><\/span> <span style=\"font-size: large\"><span lang=\"en-US\">Alias are written just after the column name .<\/span><\/span> <span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">The AS statement can be written between the column name and the alias we give to the column , but it is not mandatory . AS is used here as \u201cas\u201d .<\/span><\/span><\/span> <span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">If you want to use as # , $ , , uppercase and lowercase letters and Turkish characters , Alias is written in double quotes .<\/span><\/span><\/span><\/p>\n<pre><em>SELECT CUST_FIRST_NAME \"ADI\" FROM SH.CUSTOMERS;<\/em><\/pre>\n<p align=\"left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-11807\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/7-1.png\" alt=\"\" width=\"274\" height=\"172\" \/><\/p>\n<p align=\"left\"><span style=\"color: #ce181e\"><span style=\"font-size: large\"><span lang=\"en-US\">JOINING OPERATOR<\/span> <\/span><\/span><\/p>\n<ul>\n<li>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">Used to merge columns and strings.<\/span> <\/span><\/span><\/p>\n<\/li>\n<li>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">Pipe = \u2018| | \u2018 .<\/span> <\/span><\/span><\/p>\n<\/li>\n<li>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">The CONCAT command can be used for merge operations .<\/span> <\/span><\/span><\/p>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<pre><em>SELECT DISTINCT CUST_FIRST_NAME | | ' ' | | CUST_LAST_NAME AS \"AD SOYAD\" FROM SH.CUSTOMERS;<\/em><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-11809\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/9-1.png\" alt=\"\" width=\"232\" height=\"219\" \/><\/p>\n<p align=\"left\"><span style=\"color: #ba131a\"><span style=\"font-size: large\"><span lang=\"en-US\">REPEATING LINES<\/span> <\/span><\/span><\/p>\n<ul>\n<li>\n<p align=\"left\"><span style=\"font-size: large\"><span style=\"color: #000000\"><span lang=\"en-US\">We use the DISTINCT command to combine multiple but identical lines into a single row .<\/span><\/span> <span lang=\"en-US\">In our example below , we ran this query because we don&#8217;t want to see duplicate values in the cust_first_name column .<\/span> <\/span><\/p>\n<\/li>\n<\/ul>\n<pre><em>SELECT DISTINCT CUST_FIRST_NAME FROM SH.CUSTOMERS;<\/em><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-11811\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/11-1.png\" alt=\"\" width=\"252\" height=\"275\" \/><\/p>\n<p align=\"left\"><span style=\"color: #ce181e\"><span style=\"font-size: large\"><span lang=\"en-US\">VIEWING TABLE STRUCTURE<\/span> <\/span><\/span><\/p>\n<ul>\n<li>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">The DESCRIBE command is used to display the table structure . Usage :<\/span> <\/span><\/span><\/p>\n<\/li>\n<\/ul>\n<p><span style=\"color: #000000\"><span style=\"font-size: large\"> DESC[RIBE] table_name ; <\/span><\/span><\/p>\n<pre><span style=\"color: #000000\"><span style=\"font-size: large\"><em>DESC SH.COSTS;<\/em><\/span><\/span><\/pre>\n<p><span style=\"color: #000000\"><span style=\"font-size: large\"> \u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-11813\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/13-300x189.png\" alt=\"\" width=\"329\" height=\"207\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/13-300x189.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/13.png 342w\" sizes=\"auto, (max-width: 329px) 100vw, 329px\" \/><\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">This is the structure of the sh.costs table you see above .<\/span> <\/span><\/span><\/p>\n<p align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><span lang=\"en-US\">another example<\/span> :<\/span><\/span><\/p>\n<pre><em>DESC ADMIN.NEW_TABLE;<\/em><\/pre>\n<p><em><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-12252\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/desc2-300x158.png\" alt=\"\" width=\"300\" height=\"158\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/desc2-300x158.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/desc2.png 318w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/em><\/p>\n<p lang=\"en-US\" align=\"left\"><span style=\"color: #000000\"><span style=\"font-size: large\"><b>See you in my next post.<\/b><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello , In this article, I will tell you about the expressions that form the basis of sql and how to give aliases to columns. NULL EXPRESSION Null values are unknown , unspecified . When null is entered into an arithmetic operation , the result will be null . SELECT EXPRESSION With the SELECT statement &hellip;<\/p>\n","protected":false},"author":10447,"featured_media":12283,"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":[1340,1572,6837,6811,6838,6835,6836,3000],"class_list":["post-11800","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-oracle-sql","tag-oracle-sql","tag-sql","tag-sql-expression","tag-sql-information","tag-sql-joining-operator","tag-sql-operator","tag-sql-queries","tag-sql-tutorial"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/11\/sql-illustration.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/11800","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\/10447"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=11800"}],"version-history":[{"count":8,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/11800\/revisions"}],"predecessor-version":[{"id":12393,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/11800\/revisions\/12393"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/12283"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=11800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=11800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=11800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}