GithubHelp home page GithubHelp logo

test-db-pg-dvdrental's Introduction

test-db-pg-dvdrental

PostgreSQL DVD Rental database very useful to test purposes and playing with queries.

The idea was to create Docker image containing ready to use database example with sample data. I used sample database from PostgreSQL Tutorial and created Dockerfile to run postgres and restore db from backup.

Useful links

PostgreSQL Tutorial ER Diagram

PostgreSQL Tutorial DVD Rental ER Diagram

Building docker image

First of all we have to build docker image. We can do it by execute:

docker build -t pg_dvdrental .

Docker will download all needed dependencies and build image with name "pg_dvdrental". We can check it by execute:

docker images

Running docker container

To run created image we have to execute "docker run" like this:

docker run -p 5433:5432 --name dvdrental -d pg_dvdrental

Docker will run container with name "dvdrental", based on image "pg_dvdrental" and it will expose containers port 5432 on localhost port 5433.

Connect to database

Now we can connect to our database. First we need credentials:

Database name: dvdrental
Database user: dvdrental
Database password: dvdrental

So lets check it using "docker" and "psql":

docker run -it --rm --link dvdrental:postgres postgres psql -h postgres -U dvdrental -d dvdrental

After put password ("dvdrental" to remind) we are connected to database and we can do queries. Let's check actors:

SELECT * FROM actor WHERE first_name ilike 'Kevin';

test-db-pg-dvdrental's People

Contributors

kedziorski avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.