Giter Site home page Giter Site logo

sql_learning's Introduction

SQL Learning

Here is mysql environment needed to do exercises and the solutions of SQL Training.

Requirement

  • docker
  • mysql CLI (if needed)

Steps

Run mysql container

  • Change platform in docker-compose.yaml to your platform if needed.
docker-compose up -d

Connect to the container

  • Or, use CLI or application for MySQL on your local machine to connect with mysql inside the container.
docker container exec -it mysql-container /bin/sh

Connect to the mysql with CLI

  • see the password in the yaml
mysql -u root -p -h localhost -P 3306

Query data from a table

mysql> use testdb;
Database changed

mysql> show tables;
+--------------------------+
| Tables_in_testdb         |
+--------------------------+
| allergy                  |
| club                     |
| club_member              |
| ice_cream_flavor         |
| ice_cream_flavor_allergy |
| student                  |
+--------------------------+
6 rows in set (0.01 sec)

mysql> select * from ice_cream_flavor LIMIT 10;
+---------------------------------------------------+-----------+---------+--------------+------------+
| name                                              | kind      | calorie | is_available | created_at |
+---------------------------------------------------+-----------+---------+--------------+------------+
| コットンキャンディワンダーランド                       | THE 31    |     162 |            1 | 2021-02-21 |
| チョップドチョコレート                               | CHOCOLATE |     175 |            1 | 2021-05-12 |
| ナッツトゥユー                                      | ELEGANT   |     168 |            0 | 1998-12-30 |
| ラブポーションサーティワン                            | THE 31    |     160 |            0 | 2019-04-22 |
| ロッキーロード                                      | CHOCOLATE |     175 |            1 | 2012-05-02 |
| 小倉トースト 〜大納言あずき使用〜                      | ELEGANT   |     153 |            1 | 2021-01-03 |
+---------------------------------------------------+-----------+---------+--------------+------------+
6 rows in set (0.01 sec)

Remove all resources created by up

docker-compose down --rmi all --volumes

sql_learning's People

Contributors

yutamiyake avatar

Stargazers

Yusuke Saito avatar Haruki Ido avatar

Watchers

James Cloos avatar  avatar

Forkers

harukiido

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.