{"id":19812,"date":"2020-07-20T22:58:48","date_gmt":"2020-07-21T05:58:48","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19812"},"modified":"2021-01-04T05:49:06","modified_gmt":"2021-01-04T13:49:06","slug":"sql-comment","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/sql-comment\/","title":{"rendered":"SQL Comments Using Single- and Multiline Comments"},"content":{"rendered":"\n<p><em>There are two types of comments in SQL statements: single-line and multi-line. We\u2019ll take a look at these in our article with an example of each and discuss why we might use comments<\/em><br><\/p>\n\n\n\n<p>When we make comments in our code, what we do as developers is make our intentions known with our code. It\u2019s always a good idea to illustrate or tell what our code does so the next developer who comes along to edit your code can easily read it and take the project forward without having to come find you to question you about your code is supposed to do.&nbsp;<\/p>\n\n\n\n<p>In SQL statements, there are two ways to make comments \u2013 a single line comment when you only need to add a single line comment, and then a multi-line comment when you need to add more than one line.<br><\/p>\n\n\n\n<p>A single line comment is illustrated by two single hyphens at the beginning of the line you would like to comment out:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>CREATE TABLE names (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(128) NOT NULL\n);\nINSERT into names VALUES (1, &quot;Christina&quot;);\nINSERT into names VALUES (2, &quot;Ashleigh&quot;);\nINSERT into names VALUES (3, &quot;Sarah&quot;);\nINSERT into names VALUES (4, &quot;Tad&quot;);\nINSERT into names VALUES (5, &quot;Dustin&quot;);\n--INSERT into names VALUES (6, &quot;Elissa&quot;);\nINSERT into names VALUES (7, &quot;Kelly&quot;);\n \nSELECT * from names<\/pre><\/div>\n\n\n\n<p>A multi-line comment is just like multi-line comments in JavaScript or like comments in CSS: it spans multiple lines.<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>CREATE TABLE names (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(128) NOT NULL\n);\nINSERT into names VALUES (1, &quot;Christina&quot;);\nINSERT into names VALUES (2, &quot;Ashleigh&quot;);\nINSERT into names VALUES (3, &quot;Sarah&quot;);\nINSERT into names VALUES (4, &quot;Tad&quot;);\n\/*INSERT into names VALUES (5, &quot;Dustin&quot;); \nINSERT into names VALUES (6, &quot;Elissa&quot;)*\/\nINSERT into names VALUES (7, &quot;Kelly&quot;);\n \nSELECT * from names<\/pre><\/div>\n\n\n\n<p>Here, we have commented out two lines using the familiar \/ * comment goes here * \/ syntax we are familiar with from multi-line comments in JS and comments in CSS.&nbsp;<br><\/p>\n\n\n\n<p>If you feel comfortable with writing comments in SQL, please check out the following tutorials next!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">More Resources:&nbsp;<\/h3>\n\n\n\n<h5 class=\"wp-block-heading\"><a href=\"https:\/\/careerkarma.com\/blog\/sql-create-table\/\">SQL Create Table<\/a><\/h5>\n\n\n\n<h5 class=\"wp-block-heading\"><a href=\"https:\/\/careerkarma.com\/blog\/sql-where\/\">SQL Where<\/a><\/h5>\n","protected":false},"excerpt":{"rendered":"There are two types of comments in SQL statements: single-line and multi-line. We\u2019ll take a look at these in our article with an example of each and discuss why we might use comments When we make comments in our code, what we do as developers is make our intentions known with our code. It\u2019s always&hellip;","protected":false},"author":77,"featured_media":19813,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17284],"tags":[],"class_list":{"0":"post-19812","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-sql"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"SQL","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Comments Using Single- and Multiline Comments | Career Karma<\/title>\n<meta name=\"description\" content=\"Use comments in SQL to explain statements or to test for bugs. Learn how to write multi-line and single-line comments on Career Karma.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/sql-comment\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Comments Using Single- and Multiline Comments\" \/>\n<meta property=\"og:description\" content=\"Use comments in SQL to explain statements or to test for bugs. Learn how to write multi-line and single-line comments on Career Karma.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/sql-comment\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-21T05:58:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-04T13:49:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"765\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christina Kopecky\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christina Kopecky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/\"},\"author\":{\"name\":\"Christina Kopecky\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\"},\"headline\":\"SQL Comments Using Single- and Multiline Comments\",\"datePublished\":\"2020-07-21T05:58:48+00:00\",\"dateModified\":\"2021-01-04T13:49:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/\"},\"wordCount\":243,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg\",\"articleSection\":[\"SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/\",\"name\":\"SQL Comments Using Single- and Multiline Comments | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg\",\"datePublished\":\"2020-07-21T05:58:48+00:00\",\"dateModified\":\"2021-01-04T13:49:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\"},\"description\":\"Use comments in SQL to explain statements or to test for bugs. Learn how to write multi-line and single-line comments on Career Karma.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg\",\"width\":1020,\"height\":765,\"caption\":\"Multiple screens with computer code\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql-comment\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/sql\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"SQL Comments Using Single- and Multiline Comments\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\",\"name\":\"Christina Kopecky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"caption\":\"Christina Kopecky\"},\"description\":\"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.\",\"sameAs\":[\"http:\\\/\\\/www.linkedin.com\\\/in\\\/cmvnk\"],\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/christina-kopecky\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Comments Using Single- and Multiline Comments | Career Karma","description":"Use comments in SQL to explain statements or to test for bugs. Learn how to write multi-line and single-line comments on Career Karma.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/careerkarma.com\/blog\/sql-comment\/","og_locale":"en_US","og_type":"article","og_title":"SQL Comments Using Single- and Multiline Comments","og_description":"Use comments in SQL to explain statements or to test for bugs. Learn how to write multi-line and single-line comments on Career Karma.","og_url":"https:\/\/careerkarma.com\/blog\/sql-comment\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-21T05:58:48+00:00","article_modified_time":"2021-01-04T13:49:06+00:00","og_image":[{"width":1020,"height":765,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg","type":"image\/jpeg"}],"author":"Christina Kopecky","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"Christina Kopecky","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/"},"author":{"name":"Christina Kopecky","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"headline":"SQL Comments Using Single- and Multiline Comments","datePublished":"2020-07-21T05:58:48+00:00","dateModified":"2021-01-04T13:49:06+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/"},"wordCount":243,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg","articleSection":["SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/sql-comment\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/","url":"https:\/\/careerkarma.com\/blog\/sql-comment\/","name":"SQL Comments Using Single- and Multiline Comments | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg","datePublished":"2020-07-21T05:58:48+00:00","dateModified":"2021-01-04T13:49:06+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"description":"Use comments in SQL to explain statements or to test for bugs. Learn how to write multi-line and single-line comments on Career Karma.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/sql-comment\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg","width":1020,"height":765,"caption":"Multiple screens with computer code"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/sql-comment\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL","item":"https:\/\/careerkarma.com\/blog\/sql\/"},{"@type":"ListItem","position":3,"name":"SQL Comments Using Single- and Multiline Comments"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e","name":"Christina Kopecky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","caption":"Christina Kopecky"},"description":"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.","sameAs":["http:\/\/www.linkedin.com\/in\/cmvnk"],"url":"https:\/\/careerkarma.com\/blog\/author\/christina-kopecky\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19812","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=19812"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19812\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19813"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}