{"id":4459,"date":"2018-04-02T15:24:32","date_gmt":"2018-04-02T15:24:32","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2018\/04\/02\/how-to-create-database-tables-with-sql\/"},"modified":"2021-10-26T14:59:24","modified_gmt":"2021-10-26T18:59:24","slug":"how-to-create-database-tables-with-sql","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/","title":{"rendered":"How to Create Database Tables with SQL"},"content":{"rendered":"\n<p>We have already learned <a href=\"\/support\/server\/databases\/what-is-sql\/\">what SQL is<\/a> and how we can use basic <a href=\"\/support\/server\/databases\/how-to-write-select-statements\/\">select statements<\/a> to get information out of our database. We can use that information we&#8217;ve selected to draw insights from potentially complicated databases. In this article, we&#8217;re going to learn <strong>how to create database tables with SQL<\/strong>.<\/p>\n\n\n\n<p>Remember that tables are basically database items that <a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/databases\/mariadb-adding-removing-indexes\/\">contain<\/a> organized columns of data. In the article about select statements, we were working with a table called &#8220;respondents&#8221;. This table contained a vast list of people who had repsonded to an email campaign indicating that they would like to receive new emails. The columns of this table included a unique identification number for each respondent as well as their name, email, and IP address.<\/p>\n\n\n\n<p>In the following example we&#8217;re going to show you the code used to create the respondents table:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted code_block\"><span style=\"color: #00bfff;\">CREATE TABLE<\/span> <em>respondents<\/em> (     id <span style=\"color: #458b74;\">INT<\/span>,     first_name <span style=\"color: #458b74;\">VARCHAR(50)<\/span>,     last_name <span style=\"color: #458b74;\">VARCHAR(50)<\/span>,     email <span style=\"color: #458b74;\">VARCHAR(50)<\/span>,     ip_address <span style=\"color: #458b74;\">VARCHAR(20)<\/span> );<\/pre>\n\n\n\n<p>Notice, in the code block above, the first line starts the &#8220;CREATE TABLE&#8221; statement followed by open parenthesis. Each new line (followed by a comma) introduces the name of a new column in the table and what kind of &#8220;datatype&#8221; it will hold. For example, numbers can be held within an INT (integer) datatype.<\/p>\n\n\n\n<div class=\"alert alert-info\" role=\"alert\">For the most detailed and expansive information about acceptable SQL datatypes you should check out the documentation provided by Oracle or various books about database administration.<\/div>\n\n\n\n<p>You now have a better understanding of the syntax and usage of the &#8220;create table&#8221; statement in SQL. And, you have an example of how this statmement is used in the wild. Be sure to leave a comment if you have any questions.<\/p>\n\n\n\n<p class=\"alert alert-info\"><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\">If you&#8217;re looking for an all-in-one database solution, consider getting your own <a href=\"https:\/\/www.inmotionhosting.com\/managed-dedicated-servers\">managed dedicated hosting<\/a> for limitless resources and customization.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have already learned what SQL is and how we can use basic select statements to get information out of our database. We can use that information we&#8217;ve selected to draw insights from potentially complicated databases. In this article, we&#8217;re going to learn how to create database tables with SQL. Remember that tables are basically<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/\"> Read More ><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4288,4305],"tags":[],"class_list":["post-4459","post","type-post","status-publish","format-standard","hentry","category-website","category-databases"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create Database Tables with SQL | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"In this article, you will learn about creating tables in SQL.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create Database Tables with SQL | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"In this article, you will learn about creating tables in SQL.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-02T15:24:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-26T18:59:24+00:00\" \/>\n<meta name=\"author\" content=\"Christopher Maiorana\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Maiorana\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/\"},\"author\":{\"name\":\"Christopher Maiorana\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\"},\"headline\":\"How to Create Database Tables with SQL\",\"datePublished\":\"2018-04-02T15:24:32+00:00\",\"dateModified\":\"2021-10-26T18:59:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/\"},\"wordCount\":294,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Website\",\"Working with Databases\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/\",\"name\":\"How to Create Database Tables with SQL | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2018-04-02T15:24:32+00:00\",\"dateModified\":\"2021-10-26T18:59:24+00:00\",\"description\":\"In this article, you will learn about creating tables in SQL.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create Database Tables with SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\",\"name\":\"Christopher Maiorana\",\"description\":\"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create Database Tables with SQL | InMotion Hosting","description":"In this article, you will learn about creating tables in SQL.","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:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/","og_locale":"en_US","og_type":"article","og_title":"How to Create Database Tables with SQL | InMotion Hosting","og_description":"In this article, you will learn about creating tables in SQL.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2018-04-02T15:24:32+00:00","article_modified_time":"2021-10-26T18:59:24+00:00","author":"Christopher Maiorana","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Christopher Maiorana","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/"},"author":{"name":"Christopher Maiorana","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f"},"headline":"How to Create Database Tables with SQL","datePublished":"2018-04-02T15:24:32+00:00","dateModified":"2021-10-26T18:59:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/"},"wordCount":294,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Website","Working with Databases"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/","name":"How to Create Database Tables with SQL | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2018-04-02T15:24:32+00:00","dateModified":"2021-10-26T18:59:24+00:00","description":"In this article, you will learn about creating tables in SQL.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-database-tables-with-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Create Database Tables with SQL"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f","name":"Christopher Maiorana","description":"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.","sameAs":["https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4288,"name":"Website","slug":"website","link":"https:\/\/www.inmotionhosting.com\/support\/website\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4459"}],"version-history":[{"count":4,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4459\/revisions"}],"predecessor-version":[{"id":90344,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4459\/revisions\/90344"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}