How To Load A Database That Was Saved As A Text Document File
Tags: tutorial, database, postgres, beginners
Published: 2022-06-28 11:59:38

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?

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.

Let's proceed.
First of all, Introduction.

**What is a TXT file?**
**A TXT file** is a standard text document that contains plain text. It can be opened and edited in any text-editing or word-processing program. 

**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.

**Valentina Studio** is a database management tool that helps to create, administer, query, and explore Valentina DB, MySQL, MariaDB, PostgreSQL, and SQLite databases for free.


Here, the Database I was given was saved as a 'text document file format'. Below is a screenshot showing it.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qlrur5r2azwr5irydwrn.png)

Step 1: **Create a PostgreSQL Database on your Valentina Studio.**
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.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0xg0anw661unk2z0i3n.png)

Step 2: **Open and Copy the Database text file document**.
(a) To **Open** 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'.
(b) To **Copy** 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:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pd9ayiyfofa4culy9xp.png)

You are going to 'Paste' everything you have 'Copied' next.

Step 3: **Paste into the Database**
(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:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mqv8dw3p29676kswfzx7.png)

(b) Now "Paste" what you just "Copied" into that Query SQL Editor by using the short-cut "Ctrl V". Below is my screenshot:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z9zvytv6nybp519r1mcx.png)

(c) Next click "Execute" to run the Query you have copied. Below is the screenshot:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qny9ty15o1we59jq9jx9.png)

After the "Execution" is done running, you will see the "Query has been executed" like this screenshot: 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/54n4dq67wdqh7p26x8ap.png)

With that, the "Tables" have been created in your Database Schemas. To see the tables in your Database, click on ">" near "Schemas". Then click on ">" near "public". Then click on ">" 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
(iv) sales_reps (v) web_events

Below is the screenshot:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yi6inx4wy7w6zwfpibbr.png)

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.