{"id":1797,"date":"2016-09-12T17:15:58","date_gmt":"2016-09-12T14:15:58","guid":{"rendered":"http:\/\/www.systemcodegeeks.com\/?p=1797"},"modified":"2017-12-04T16:06:08","modified_gmt":"2017-12-04T14:06:08","slug":"postgresql-database-creation","status":"publish","type":"post","link":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/","title":{"rendered":"PostgreSQL: Database Creation and Data Population"},"content":{"rendered":"<p><em>This article is part of our Academy Course titled <a href=\"http:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-tutorial\/\">PostgreSQL Database Tutorial<\/a>.<\/p>\n<p>In this course, we provide a compilation of PostgreSQL tutorials that will help you set up and run your own database management system. We cover a wide range of topics, from installation and configuration, to custom commands and datatypes. With our straightforward tutorials, you will be able to get your own projects up and running in minimum time. Check it out <a href=\"http:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-tutorial\/\">here<\/a>!<\/em><\/p>\n<p>In the first tutorial of this series (<a href=\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-introduction-installation\/\">PostgreSQL: Introduction and installation tutorial<\/a>) we explained how to download a sample database and import it into our PostgreSQL server. This approach, although appropriate at the time, did not show how to create a database of our own from scratch &#8211; which is an essential skill that every database administrator (DBA) or developer who intends to use PostgreSQL must has. In addition, under regular circumstances there are multiple database user accounts with different access permissions based on their respective assigned tasks. For that reason, we will also cover the topic of user creation here.<\/p>\n<div class=\"tip\">One important principle in database administration consists in creating as many users as needed depending on the required access privileges, but restricting such at a minimum. In other words, it is not wise to use the same database account for all applications since as that represents a serious security issue: if different accounts with different access permissions are used for separate applications, a compromised account will not necessarily has a negative impact on the others.<\/div>\n<p>[ulp id=&#8217;mezv5fambxsNcQw8&#8242;]<\/p>\n<h2>1. Creating a new database<\/h2>\n<p>To being, let\u2019s switch to the postgresql Linux account and enter the psql prompt.<\/p>\n<pre class=\"brush:bash\">sudo -i -u postgres\r\npsql<\/pre>\n<p>As we have explained previously, at this point we are not connected to any database.<\/p>\n<p>Inside the database we were about to create, we will add two tables where we will store the actual information in an organized manner. Our database will be called <b>BookstoreDB <\/b>and the two tables will be <b>AuthorsTBL <\/b>and <b>BooksTBL<\/b> with the following fields in them (if you feel you need to brush up your memory about data types, feel free to refer to <a href=\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-commands-datatypes\/\">PostgreSQL commands and datatypes<\/a>):<\/p>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\"><b>AuthorsTBL<\/b><\/td>\n<\/tr>\n<tr>\n<td><b>Field name<\/b><\/td>\n<td><b>Data type<\/b><\/td>\n<\/tr>\n<tr>\n<td>AuthorID<\/td>\n<td>serial, primary key<\/td>\n<\/tr>\n<tr>\n<td>AuthorName<\/td>\n<td>varchar(100)<\/td>\n<\/tr>\n<tr>\n<td>LastPublishedDate<\/td>\n<td>date<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\"><b>BooksTBL<\/b><\/td>\n<\/tr>\n<tr>\n<td><b>Field name<\/b><\/td>\n<td><b>Data type<\/b><\/td>\n<\/tr>\n<tr>\n<td>BookID<\/td>\n<td>serial, primary key<\/td>\n<\/tr>\n<tr>\n<td>BookName<\/td>\n<td>varchar(100)<\/td>\n<\/tr>\n<tr>\n<td>AuthorID<\/td>\n<td>int, foreign key<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"tip\">A primary key is a field in a table that is unique for each record, whereas a foreign key is a field that points to a primary key in another table. When performing operations on the table where the foreign key exists, it is required that the value used for such field exists as the primary key in the other table.<\/div>\n<p>However, we will begin by creating a database role (also known as username) so that in the next step we will use it as owner of the database:<\/p>\n<pre class=\"brush:bash\">CREATE ROLE scg;<\/pre>\n<p>That said, let\u2019s create the new database as follows:<\/p>\n<pre class=\"brush:bash\">CREATE DATABASE BookstoreDB OWNER scg;<\/pre>\n<p>The expected output is shown in Fig. 1:<\/p>\n<figure id=\"attachment_1799\" aria-describedby=\"caption-attachment-1799\" style=\"width: 470px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/01postgresql5.png\"><img decoding=\"async\" class=\"size-full wp-image-1799\" src=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/01postgresql5.png\" alt=\"Creating a role and use it as owner of a new database\" width=\"470\" height=\"125\" srcset=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/01postgresql5.png 470w, https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/01postgresql5-300x80.png 300w\" sizes=\"(max-width: 470px) 100vw, 470px\" \/><\/a><figcaption id=\"caption-attachment-1799\" class=\"wp-caption-text\">Figure 1 &#8211; Creating a role and use it as owner of a new database<\/figcaption><\/figure>\n<p>Next, we will connect to our newly-created database and create the tables:<\/p>\n<pre class=\"brush:bash\">\\c bookstoredb;\r\n\r\nCREATE TABLE AuthorsTBL (\r\nAuthorID \u00a0\u00a0\u00a0SERIAL PRIMARY KEY,\r\nAuthorName \u00a0\u00a0\u00a0VARCHAR(100),\r\nLastPublishedDate \u00a0\u00a0\u00a0DATE\r\n);\r\n\r\nCREATE TABLE BooksTBL (\r\nBookID \u00a0\u00a0\u00a0SERIAL PRIMARY KEY,\r\nBookName \u00a0\u00a0\u00a0VARCHAR(100),\r\nAuthorID \u00a0\u00a0\u00a0SERIAL,\r\nFOREIGN KEY (AuthorID) REFERENCES AuthorsTBL (AuthorID)\r\n);\r\n<\/pre>\n<p>Now the next step consists of\u00a0populating the database with actual data.<\/p>\n<h2>2. Populating the database<\/h2>\n<p>Since BooksTBL contains a foreign key that points to AuthorsID in AuthorsTBL, we will need to create a few records in that table first using the INSERT statement as follows. Note that each value must match the right field and data type:<\/p>\n<pre class=\"brush:bash\">INSERT INTO AuthorsTBL (AuthorName, LastPublishedDate) VALUES ('J. K. Rowling', '2011-07-11');\r\nINSERT INTO AuthorsTBL (AuthorName, LastPublishedDate) VALUES ('John Doe', '2015-08-29');<\/pre>\n<p>Afterwards, we can use the SELECT statement to query the AuthorsTBL. Note how the AuthorID field was populated automatically since its data type was set to serial and primary key (see Fig. 2):<\/p>\n<figure id=\"attachment_1800\" aria-describedby=\"caption-attachment-1800\" style=\"width: 724px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/02postgresql5.png\"><img decoding=\"async\" class=\"size-full wp-image-1800\" src=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/02postgresql5.png\" alt=\"Inserting records and querying the database\" width=\"724\" height=\"270\" srcset=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/02postgresql5.png 724w, https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/02postgresql5-300x112.png 300w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/a><figcaption id=\"caption-attachment-1800\" class=\"wp-caption-text\">Figure 2 &#8211; Inserting records and querying the database<\/figcaption><\/figure>\n<p>Next, let\u2019s insert some records into the BooksTBL table. If we try to insert a record with an AuthorID that does not exist in AuthorsTBL we will get an error as you can see in Fig. 3:<\/p>\n<pre class=\"brush:bash\">INSERT INTO BooksTBL (BookName, AuthorID) VALUES ('Harry Potter', 3);\r\nINSERT INTO BooksTBL (BookName, AuthorID) VALUES ('Harry Potter and the philosophers stone', 1);\r\nINSERT INTO BooksTBL (BookName, AuthorID) VALUES ('Harry Potter and the half-blood prince', 1);\r\nINSERT INTO BooksTBL (BookName, AuthorID) VALUES ('Whatever', 2);\r\nINSERT INTO BooksTBL (BookName, AuthorID) VALUES ('Whatever returns', 2);<\/pre>\n<figure id=\"attachment_1801\" aria-describedby=\"caption-attachment-1801\" style=\"width: 913px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/03postgresql5.png\"><img decoding=\"async\" class=\"size-full wp-image-1801\" src=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/03postgresql5.png\" alt=\"Inserting data with a non-existent foreign key causes an error\" width=\"913\" height=\"270\" srcset=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/03postgresql5.png 913w, https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/03postgresql5-300x89.png 300w, https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/03postgresql5-768x227.png 768w\" sizes=\"(max-width: 913px) 100vw, 913px\" \/><\/a><figcaption id=\"caption-attachment-1801\" class=\"wp-caption-text\">Figure 3 &#8211; Inserting data with a non-existent foreign key causes an error<\/figcaption><\/figure>\n<p>As you can see, an insert with a foreign key referencing a non-existent primary key in AuthorsTBL fails.<\/p>\n<h2>3. More queries<\/h2>\n<p>The classic SELECT statement as used earlier will return all the fields in a given table (that is what the star sign * stands for). We can also restrict the number of fields by listing them after the SELECT. For example, we can do<\/p>\n<pre class=\"brush:bash\">SELECT AuthorName FROM AuthorsTBL;<\/pre>\n<p>to retrieve only the AuthorName. Of course, that\u2019s going to be of little use, but it is worth mentioning.<\/p>\n<p>We can also choose to combine records from both tables using a <a href=\"https:\/\/www.postgresql.org\/docs\/9.5\/static\/tutorial-join.html\">JOIN<\/a>. This operation allow us to return a set of records from two or more tables as if they were stored in a single one. To illustrate, we will list all book titles along with the author name and perform the JOIN on the field that both tables have in common (AuthorID):<\/p>\n<pre class=\"brush:bash\">SELECT BooksTBL.BookName, AuthorsTBL.AuthorName FROM BooksTBL JOIN AuthorsTBL ON BooksTBL.AuthorID=AuthorsTBL.AuthorID;<\/pre>\n<p>If we only want to return those books where J. K. Rowling is the author, we can add a WHERE clause and either use AuthorID=1 or AuthorName=&#8217;J. K. Rowling&#8217; in the filter. Usually, integers are preferred in WHERE clauses, so we will go with<\/p>\n<pre class=\"brush:bash\">SELECT BooksTBL.BookName, AuthorsTBL.AuthorName FROM BooksTBL JOIN AuthorsTBL ON BooksTBL.AuthorID=AuthorsTBL.AuthorID WHERE AuthorsTBL.AuthorID=1;<\/pre>\n<p>You can view the result of the above queries in Fig. 4:<\/p>\n<figure id=\"attachment_1802\" aria-describedby=\"caption-attachment-1802\" style=\"width: 914px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/04postgresql5.png\"><img decoding=\"async\" class=\"size-full wp-image-1802\" src=\"http:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/04postgresql5.png\" alt=\"Using JOINs and WHERE clauses to refine searches\" width=\"914\" height=\"367\" srcset=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/04postgresql5.png 914w, https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/04postgresql5-300x120.png 300w, https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/09\/04postgresql5-768x308.png 768w\" sizes=\"(max-width: 914px) 100vw, 914px\" \/><\/a><figcaption id=\"caption-attachment-1802\" class=\"wp-caption-text\">Figure 4 &#8211; Using JOINs and WHERE clauses to refine searches<\/figcaption><\/figure>\n<p>You can view other examples of querying in each of the previous articles in this series.<\/p>\n<h2>4. Summary<\/h2>\n<p>In this article we have explained how to create a database role and make it the owner of a database during creation. In addition, we showed how to create tables -taking into consideration the available datatypes- and how to populate and query them. By using JOINs and WHERE clauses you will be able to retrieve the necessary information as if it was all in the same table.<\/p>\n<p>Hope it helps.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is part of our Academy Course titled PostgreSQL Database Tutorial. In this course, we provide a compilation of PostgreSQL tutorials that will help you set up and run your own database management system. We cover a wide range of topics, from installation and configuration, to custom commands and datatypes. With our straightforward tutorials, &hellip;<\/p>\n","protected":false},"author":15,"featured_media":198,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1797","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-postgresql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PostgreSQL: Database Creation and Data Population - System Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"This article is part of our Academy Course titled PostgreSQL Database Tutorial. In this course, we provide a compilation of PostgreSQL tutorials that will\" \/>\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.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL: Database Creation and Data Population - System Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"This article is part of our Academy Course titled PostgreSQL Database Tutorial. In this course, we provide a compilation of PostgreSQL tutorials that will\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/\" \/>\n<meta property=\"og:site_name\" content=\"System Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/systemcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/gacanepa\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-12T14:15:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-04T14:06:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Gabriel Canepa\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@gacanepa\" \/>\n<meta name=\"twitter:site\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gabriel Canepa\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/\"},\"author\":{\"name\":\"Gabriel Canepa\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/967da353d0f1a1de21c9504942625a5f\"},\"headline\":\"PostgreSQL: Database Creation and Data Population\",\"datePublished\":\"2016-09-12T14:15:58+00:00\",\"dateModified\":\"2017-12-04T14:06:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/\"},\"wordCount\":996,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg\",\"articleSection\":[\"PostgreSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/\",\"name\":\"PostgreSQL: Database Creation and Data Population - System Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg\",\"datePublished\":\"2016-09-12T14:15:58+00:00\",\"dateModified\":\"2017-12-04T14:06:08+00:00\",\"description\":\"This article is part of our Academy Course titled PostgreSQL Database Tutorial. In this course, we provide a compilation of PostgreSQL tutorials that will\",\"breadcrumb\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#primaryimage\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.systemcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Databases\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/databases\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PostgreSQL\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/databases\/postgresql\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"PostgreSQL: Database Creation and Data Population\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"name\":\"System Code Geeks\",\"description\":\"Operating System Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/systemcodegeeks\",\"https:\/\/x.com\/systemcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/967da353d0f1a1de21c9504942625a5f\",\"name\":\"Gabriel Canepa\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/27b3ea2a3fb1de4ed1c8694a1465c099a86586d8b833a0d852a26d76d750df9f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/27b3ea2a3fb1de4ed1c8694a1465c099a86586d8b833a0d852a26d76d750df9f?s=96&d=mm&r=g\",\"caption\":\"Gabriel Canepa\"},\"description\":\"Gabriel Canepa is a Linux Foundation Certified System Administrator (LFCS-1500-0576-0100) and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work. When he's not typing commands or writing code or articles, he enjoys telling bedtime stories with his wife to his two little daughters and playing with them, the great pleasure of his life.\",\"sameAs\":[\"http:\/\/www.gabrielcanepa.com.ar\/\",\"https:\/\/www.facebook.com\/gacanepa\",\"https:\/\/ar.linkedin.com\/in\/gacanepa\",\"https:\/\/x.com\/gacanepa\"],\"url\":\"https:\/\/www.systemcodegeeks.com\/author\/gabriel-canepa\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PostgreSQL: Database Creation and Data Population - System Code Geeks - 2026","description":"This article is part of our Academy Course titled PostgreSQL Database Tutorial. In this course, we provide a compilation of PostgreSQL tutorials that will","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.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/","og_locale":"en_US","og_type":"article","og_title":"PostgreSQL: Database Creation and Data Population - System Code Geeks - 2026","og_description":"This article is part of our Academy Course titled PostgreSQL Database Tutorial. In this course, we provide a compilation of PostgreSQL tutorials that will","og_url":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/","og_site_name":"System Code Geeks","article_publisher":"https:\/\/www.facebook.com\/systemcodegeeks","article_author":"https:\/\/www.facebook.com\/gacanepa","article_published_time":"2016-09-12T14:15:58+00:00","article_modified_time":"2017-12-04T14:06:08+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg","type":"image\/jpeg"}],"author":"Gabriel Canepa","twitter_card":"summary_large_image","twitter_creator":"@gacanepa","twitter_site":"@systemcodegeeks","twitter_misc":{"Written by":"Gabriel Canepa","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#article","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/"},"author":{"name":"Gabriel Canepa","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/967da353d0f1a1de21c9504942625a5f"},"headline":"PostgreSQL: Database Creation and Data Population","datePublished":"2016-09-12T14:15:58+00:00","dateModified":"2017-12-04T14:06:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/"},"wordCount":996,"commentCount":0,"publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg","articleSection":["PostgreSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/","url":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/","name":"PostgreSQL: Database Creation and Data Population - System Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#primaryimage"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg","datePublished":"2016-09-12T14:15:58+00:00","dateModified":"2017-12-04T14:06:08+00:00","description":"This article is part of our Academy Course titled PostgreSQL Database Tutorial. In this course, we provide a compilation of PostgreSQL tutorials that will","breadcrumb":{"@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#primaryimage","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/postgresql-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.systemcodegeeks.com\/databases\/postgresql\/postgresql-database-creation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.systemcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Databases","item":"https:\/\/www.systemcodegeeks.com\/category\/databases\/"},{"@type":"ListItem","position":3,"name":"PostgreSQL","item":"https:\/\/www.systemcodegeeks.com\/category\/databases\/postgresql\/"},{"@type":"ListItem","position":4,"name":"PostgreSQL: Database Creation and Data Population"}]},{"@type":"WebSite","@id":"https:\/\/www.systemcodegeeks.com\/#website","url":"https:\/\/www.systemcodegeeks.com\/","name":"System Code Geeks","description":"Operating System Developers Resource Center","publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.systemcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.systemcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/systemcodegeeks","https:\/\/x.com\/systemcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/967da353d0f1a1de21c9504942625a5f","name":"Gabriel Canepa","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/27b3ea2a3fb1de4ed1c8694a1465c099a86586d8b833a0d852a26d76d750df9f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/27b3ea2a3fb1de4ed1c8694a1465c099a86586d8b833a0d852a26d76d750df9f?s=96&d=mm&r=g","caption":"Gabriel Canepa"},"description":"Gabriel Canepa is a Linux Foundation Certified System Administrator (LFCS-1500-0576-0100) and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work. When he's not typing commands or writing code or articles, he enjoys telling bedtime stories with his wife to his two little daughters and playing with them, the great pleasure of his life.","sameAs":["http:\/\/www.gabrielcanepa.com.ar\/","https:\/\/www.facebook.com\/gacanepa","https:\/\/ar.linkedin.com\/in\/gacanepa","https:\/\/x.com\/gacanepa"],"url":"https:\/\/www.systemcodegeeks.com\/author\/gabriel-canepa\/"}]}},"_links":{"self":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/1797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/comments?post=1797"}],"version-history":[{"count":0,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/1797\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media\/198"}],"wp:attachment":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media?parent=1797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/categories?post=1797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/tags?post=1797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}