DEV Community

Chuks
Chuks

Posted on

How To Load A Database That Was Saved As A Text Document File

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

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

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

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

(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

(c) Next click "Execute" to run the Query you have copied. Below is the screenshot:
Image description

After the "Execution" is done running, you will see the "Query has been executed" like this screenshot:
Image description

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

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.

Top comments (0)