<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chuks</title>
    <description>The latest articles on DEV Community by Chuks (@chuks).</description>
    <link>https://dev.to/chuks</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F867782%2F6abffce4-b271-4530-acf2-a5c199d0b968.png</url>
      <title>DEV Community: Chuks</title>
      <link>https://dev.to/chuks</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chuks"/>
    <language>en</language>
    <item>
      <title>How To Load A Database That Was Saved As A Text Document File</title>
      <dc:creator>Chuks</dc:creator>
      <pubDate>Tue, 28 Jun 2022 11:59:38 +0000</pubDate>
      <link>https://dev.to/chuks/how-to-load-a-database-that-was-saved-as-a-text-document-file-118f</link>
      <guid>https://dev.to/chuks/how-to-load-a-database-that-was-saved-as-a-text-document-file-118f</guid>
      <description>&lt;p&gt;If you were told to work with a given Database and that given Database was saved as a 'text document file format', how would you load the Database for you to begin to work with it?&lt;/p&gt;

&lt;p&gt;In this tutorial, I'll show you how to Load a given Database that was saved as a 'text document file format'. I loaded the Database into Postgres using Valentina Studio.&lt;/p&gt;

&lt;p&gt;Let's proceed.&lt;br&gt;
First of all, Introduction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a TXT file?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;A TXT file&lt;/strong&gt; is a standard text document that contains plain text. It can be opened and edited in any text-editing or word-processing program. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PostgreSQL&lt;/strong&gt; is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Valentina Studio&lt;/strong&gt; is a database management tool that helps to create, administer, query, and explore Valentina DB, MySQL, MariaDB, PostgreSQL, and SQLite databases for free.&lt;/p&gt;

&lt;p&gt;Here, the Database I was given was saved as a 'text document file format'. Below is a screenshot showing it.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cDxRP1mS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qlrur5r2azwr5irydwrn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cDxRP1mS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qlrur5r2azwr5irydwrn.png" alt="Image description" width="652" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 1: &lt;strong&gt;Create a PostgreSQL Database on your Valentina Studio.&lt;/strong&gt;&lt;br&gt;
Do that by (a) click 'Create Database'. (b) In the place for 'Name', write the name of the Database you want to create. Then click 'Create'. For example, in my own case, the name of the Database I created is 'parse-and-posey'. Below is a screenshot to guide you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gX09ie2y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0xg0anw661unk2z0i3n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gX09ie2y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0xg0anw661unk2z0i3n.png" alt="Image description" width="865" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2: &lt;strong&gt;Open and Copy the Database text file document&lt;/strong&gt;.&lt;br&gt;
(a) To &lt;strong&gt;Open&lt;/strong&gt; the document file 'parch-and-posey.sql', go to where it is saved in your system and double click on it or you click on the file (it will highlight it), then right-click, you will see a list of options, then select 'Open'.&lt;br&gt;
(b) To &lt;strong&gt;Copy&lt;/strong&gt; all the text in our file, Press 'Ctrl A' to copy 'all' (It will highlight everything), then Press 'Ctrl C' to copy everything. This is the screenshot below:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ih_bE0jX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pd9ayiyfofa4culy9xp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ih_bE0jX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pd9ayiyfofa4culy9xp.png" alt="Image description" width="624" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You are going to 'Paste' everything you have 'Copied' next.&lt;/p&gt;

&lt;p&gt;Step 3: &lt;strong&gt;Paste into the Database&lt;/strong&gt;&lt;br&gt;
(a) On your Valentina Studio, double click on the Database you created in Step 1 to open the Query SQL editor where you will "Paste" what you just "Copied". It should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u3tlmGTO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mqv8dw3p29676kswfzx7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u3tlmGTO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mqv8dw3p29676kswfzx7.png" alt="Image description" width="759" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(b) Now "Paste" what you just "Copied" into that Query SQL Editor by using the short-cut "Ctrl V". Below is my screenshot:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tDq8EL6b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z9zvytv6nybp519r1mcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tDq8EL6b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z9zvytv6nybp519r1mcx.png" alt="Image description" width="778" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(c) Next click "Execute" to run the Query you have copied. Below is the screenshot:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ojZh7Yin--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qny9ty15o1we59jq9jx9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ojZh7Yin--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qny9ty15o1we59jq9jx9.png" alt="Image description" width="597" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the "Execution" is done running, you will see the "Query has been executed" like this screenshot: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MK5Quxd_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/54n4dq67wdqh7p26x8ap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MK5Quxd_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/54n4dq67wdqh7p26x8ap.png" alt="Image description" width="419" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With that, the "Tables" have been created in your Database Schemas. To see the tables in your Database, click on "&amp;gt;" near "Schemas". Then click on "&amp;gt;" near "public". Then click on "&amp;gt;" near "Tables". The list of all the Tables that are in your Database will show. For example, the "Tables" in my Database, there are five (5) tables. They are: (i) accounts (ii) orders (iii) region&lt;br&gt;
(iv) sales_reps (v) web_events&lt;/p&gt;

&lt;p&gt;Below is the screenshot:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xzvJeES9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yi6inx4wy7w6zwfpibbr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xzvJeES9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yi6inx4wy7w6zwfpibbr.png" alt="Image description" width="548" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With these steps you have now learnt "How To Load A Database That Was Saved As A text document file". It's just a simple case of Copying and Pasting.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>database</category>
      <category>postgres</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How To Restore A PostgreSQL Database Using Command Line</title>
      <dc:creator>Chuks</dc:creator>
      <pubDate>Sun, 19 Jun 2022 05:17:21 +0000</pubDate>
      <link>https://dev.to/chuks/how-to-restore-a-postgresql-database-using-command-line-172e</link>
      <guid>https://dev.to/chuks/how-to-restore-a-postgresql-database-using-command-line-172e</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
PostgreSQL is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.&lt;/p&gt;

&lt;p&gt;A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS).&lt;/p&gt;

&lt;p&gt;Here, in this article, you will learn how to restore a database backup file on postgresql. When working with a new database file, it is more convenient to use the command line to restore the database, especially if the file is large so as to reduce query execution time. &lt;/p&gt;

&lt;p&gt;Let's proceed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Locating the database file&lt;/strong&gt;&lt;br&gt;
Find the location of the ".sql" file on your computer and change the directory in command line to the folder containing the database. The folder holding my database like "france", "world" and "stote" is located in "databases" folder which is located in "mydatabases" folder which is located in "Downloads" folder. To change the directory you type "cd" followed by the file path then press Enter to switch to the new directory.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6HMT0Dy0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7cjruwwn6vadjz0uev3n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6HMT0Dy0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7cjruwwn6vadjz0uev3n.png" alt="Image description" width="807" height="245"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xhycPtSn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zb1u10poi54dvlbxknkv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xhycPtSn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zb1u10poi54dvlbxknkv.png" alt="Image description" width="579" height="230"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Running the postgresql application in command line&lt;/strong&gt;&lt;br&gt;
After switching to the directory containing the database file, the next step is to run the postgersql executable file "psql.exe" in command line so that the database will be inserted through postgresql. To do this:&lt;br&gt;
(a) Copy the file path that contains the "psql.exe" file&lt;br&gt;
(b) Paste it in the command line wrapped up in quotes, this is to let the command line know that it should be run together.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sW0AZvn1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vkv61alwqiufpxz3klcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sW0AZvn1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vkv61alwqiufpxz3klcd.png" alt="Image description" width="860" height="267"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9vF0IK3_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khxl5y9n8zdpxpv72nla.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9vF0IK3_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khxl5y9n8zdpxpv72nla.png" alt="Image description" width="757" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create the respective databases in PostgreSQL&lt;/strong&gt;&lt;br&gt;
The next step is to create a database, this is the database that will house the backup file and this can be done using pgadmin.&lt;br&gt;
Right click on PostgreSQL 14, you will see "create". Click on "create" and you will see "database", then click on it to create and name your database. Then click "save". Do this to create your&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DnBLtGr1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcevwb42krlb1dtvjcim.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DnBLtGr1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcevwb42krlb1dtvjcim.png" alt="Image description" width="657" height="157"&gt;&lt;/a&gt; respective databases &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6r4_Z2GX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bo8ieym3omqumv39j69.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6r4_Z2GX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bo8ieym3omqumv39j69.png" alt="Image description" width="880" height="474"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Upload the backup database file into the created database&lt;/strong&gt;&lt;br&gt;
Lastly we want to upload the ".sql" file into the database that was created with pgadmin.&lt;br&gt;
To do this, we use the same way we wrote the command line action in step 2 only that here you have to specify the user and the database. To specify the user we write "-U username" and to specify the database, we use "-d database name".&lt;br&gt;
Here our user is "postgres" and let's say the database name is "Store" or "world" or "france", created in the previous step. Once the user and the database have been indicated, you type "&amp;lt;" followed by the file name for example "store.sql" or "world.sql" or "france.sql" then press Enter to upload the database. You will the be prompted to input your user password and after the password has been correctly inputted, the backup file will be uploaded into the database. So for example I will write "-U postgres" for the user and "-d World" for the database&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ue7jY0uD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7i6xvycfh9vmofrlbneo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ue7jY0uD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7i6xvycfh9vmofrlbneo.png" alt="Image description" width="880" height="296"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>beginners</category>
      <category>sql</category>
      <category>postgres</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
