Skip to main content

Load Data

It is possible to populate the database importing data from a file. The voc_dump.sql file can be imported into the database using the textual client interface. Some alternative ways are as follows:

_________________________________________________________________________________________

1: shell> mclient -u voc -d voc voc_dump.sql
password:<voc>
2:shell> mclient -u voc -d voc < voc_dump.sql
password:<voc>
3:shell> mclient -u voc -d voc
password:<voc>
sql> \< voc_dump.sql
___________________________________________________________________________________

 

After the import procedure is complete, we can access it through the mclient interface. The VOC data set contains data for around 8000 voyages.

___________________________________________________________________________________
sql>\d
TABLE  voc.craftsmen
TABLE  voc.impotenten
TABLE  voc.invoices
TABLE  voc.passengers
TABLE  voc.seafarers
TABLE  voc.soldiers
TABLE  voc.total
TABLE  voc.voyages

_________________________________________________________________________________________

Let's check out the data we just loaded. First, count the number of rows the voyages table.

_________________________________________________________________________________________

sql>SELECT count(*) FROM voyages;
+------+
| L1   |
+======+
| 8131 |
+------+

_________________________________________________________________________________________

In the next section we are going to show examples on how to play with views and queries