diff --git a/docs/chapter1/section4/1_sql.md b/docs/chapter1/section4/1_sql.md index 44600ea7..e18de97a 100644 --- a/docs/chapter1/section4/1_sql.md +++ b/docs/chapter1/section4/1_sql.md @@ -14,7 +14,7 @@ mysql> SHOW DATABASES; 以下のように出力されるはずです。 -```txt +```html +--------------------+ | Database | +--------------------+ @@ -44,7 +44,7 @@ mysql> USE world; mysql> SHOW TABLES; ``` -```txt +```html +-----------------+ | Tables_in_world | +-----------------+ @@ -69,7 +69,7 @@ mysql> DESCRIBE city; mysql> SHOW COLUMNS FROM city; ``` -```txt +```html +-------------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+----------+------+-----+---------+----------------+ @@ -96,7 +96,7 @@ https://dev.mysql.com/doc/refman/8.0/ja/getting-information.html mysql> SELECT Name, Population FROM city; ``` -```txt +```html +-----------------------------------+------------+ | Name | Population | +-----------------------------------+------------+ @@ -123,7 +123,7 @@ https://dev.mysql.com/doc/refman/8.0/ja/select.html mysql> SELECT * FROM city; ``` -```txt +```html +------+-----------------------------------+-------------+----------------------+------------+ | ID | Name | CountryCode | District | Population | +------+-----------------------------------+-------------+----------------------+------------+ @@ -148,7 +148,7 @@ mysql> SELECT * FROM city; mysql> SELECT * FROM city LIMIT 5; ``` -```txt +```html +----+----------------+-------------+---------------+------------+ | ID | Name | CountryCode | District | Population | +----+----------------+-------------+---------------+------------+ @@ -169,7 +169,7 @@ mysql> SELECT * FROM city LIMIT 5; mysql> SELECT * FROM city LIMIT 5 OFFSET 10; ``` -```txt +```html +----+-----------+-------------+---------------+------------+ | ID | Name | CountryCode | District | Population | +----+-----------+-------------+---------------+------------+ @@ -190,7 +190,7 @@ mysql> SELECT * FROM city LIMIT 5 OFFSET 10; mysql> SELECT * FROM city WHERE Population >= 8000000; ``` -```txt +```html +------+-------------------+-------------+------------------+------------+ | ID | Name | CountryCode | District | Population | +------+-------------------+-------------+------------------+------------+ @@ -212,7 +212,7 @@ mysql> SELECT * FROM city WHERE Population >= 8000000; mysql> SELECT * FROM city WHERE CountryCode = "JPN" AND Population > 5000000; ``` -```txt +```html +------+-------+-------------+----------+------------+ | ID | Name | CountryCode | District | Population | +------+-------+-------------+----------+------------+ @@ -229,7 +229,7 @@ mysql> SELECT * FROM city WHERE CountryCode = "JPN" AND Population > 5000000; SELECT * FROM city WHERE Population >= 8000000 ORDER BY Population DESC; ``` -```txt +```html +------+-------------------+-------------+------------------+------------+ | ID | Name | CountryCode | District | Population | +------+-------------------+-------------+------------------+------------+ @@ -258,7 +258,7 @@ https://dev.mysql.com/doc/refman/8.0/ja/sorting-rows.html mysql> SELECT * FROM city WHERE District IN ("Kagawa", "Tokushima", "Ehime", "Kochi"); ``` -```txt +```html +------+-----------+-------------+-----------+------------+ | ID | Name | CountryCode | District | Population | +------+-----------+-------------+-----------+------------+ @@ -286,7 +286,7 @@ https://dev.mysql.com/doc/refman/8.0/ja/comparison-operators.html#operator_in mysql> DESCRIBE countrylanguage; ``` -```txt +```html +-------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------+------+-----+---------+-------+ @@ -304,7 +304,7 @@ mysql> DESCRIBE countrylanguage; mysql> SELECT country.Name, countrylanguage.Language FROM country JOIN countrylanguage ON country.Code = countrylanguage.CountryCode WHERE countrylanguage.Language = "Chinese"; ``` -```txt +```html +--------------------------+----------+ | Name | Language | +--------------------------+----------+ @@ -348,7 +348,7 @@ https://dev.mysql.com/doc/refman/8.0/ja/join.html mysql> SELECT Name, District AS Prefecture FROM city WHERE CountryCode = "JPN"; ``` -```txt +```html +---------------------+------------+ | Name | Prefecture | +---------------------+------------+ @@ -388,7 +388,7 @@ https://dev.mysql.com/doc/refman/8.0/ja/problems-with-alias.html mysql> SELECT COUNT(*) FROM city WHERE CountryCode = "JPN"; ``` -```txt +```html +----------+ | count(*) | +----------+ @@ -408,7 +408,7 @@ https://dev.mysql.com/doc/refman/8.0/ja/aggregate-functions.html#function_count SELECT CountryCode, COUNT(*) FROM city GROUP BY CountryCode; ``` -```txt +```html +-------------+----------+ | CountryCode | COUNT(*) | +-------------+----------+ @@ -444,7 +444,7 @@ mysql> INSERT INTO city (Name, CountryCode, District, Population) VALUES ("oooka mysql> SELECT * FROM city ORDER BY ID DESC LIMIT 1; ``` -```txt +```html +------+-----------+-------------+----------+------------+ | ID | Name | CountryCode | District | Population | +------+-----------+-------------+----------+------------+ @@ -465,7 +465,7 @@ mysql> UPDATE city SET Population = 9999 WHERE ID = 4080; mysql> SELECT * FROM city WHERE ID = 4080; ``` -```txt +```html +------+-----------+-------------+----------+------------+ | ID | Name | CountryCode | District | Population | +------+-----------+-------------+----------+------------+ @@ -491,7 +491,7 @@ mysql> DELETE FROM city WHERE ID = 4080; mysql> SELECT * FROM city WHERE ID = 4080; ``` -```txt +```html Empty set (0.00 sec) ``` diff --git a/docs/chapter1/section4/2_sql_exercise.md b/docs/chapter1/section4/2_sql_exercise.md index 0a7ecec0..43b95766 100644 --- a/docs/chapter1/section4/2_sql_exercise.md +++ b/docs/chapter1/section4/2_sql_exercise.md @@ -17,7 +17,7 @@ SELECT * FROM country WHERE Name = "Japan"; **出力** -```txt +```html +------+-------+-----------+--------------+-------------+-----------+------------+----------------+------------+------------+--------------+-------------------------+-------------+---------+-------+ | Code | Name | Continent | Region | SurfaceArea | IndepYear | Population | LifeExpectancy | GNP | GNPOld | LocalName | GovernmentForm | HeadOfState | Capital | Code2 | +------+-------+-----------+--------------+-------------+-----------+------------+----------------+------------+------------+--------------+-------------------------+-------------+---------+-------+ @@ -40,7 +40,7 @@ SELECT * FROM country WHERE IndepYear <= 0; **出力** -```txt +```html +------+----------+-----------+----------------+-------------+-----------+------------+----------------+------------+------------+--------------+-------------------------+----------------+---------+-------+ | Code | Name | Continent | Region | SurfaceArea | IndepYear | Population | LifeExpectancy | GNP | GNPOld | LocalName | GovernmentForm | HeadOfState | Capital | Code2 | +------+----------+-----------+----------------+-------------+-----------+------------+----------------+------------+------------+--------------+-------------------------+----------------+---------+-------+ @@ -65,7 +65,7 @@ SELECT Name, Population FROM country WHERE Continent = "Asia" ORDER BY Populatio **出力** -```txt +```html +------------+------------+ | Name | Population | +------------+------------+ @@ -92,7 +92,7 @@ SELECT * FROM country ORDER BY Population DESC LIMIT 5 OFFSET 10; **出力** -```txt +```html +------+-------------+---------------+-----------------+-------------+-----------+------------+----------------+------------+------------+-------------+----------------------+-------------------------+---------+-------+ | Code | Name | Continent | Region | SurfaceArea | IndepYear | Population | LifeExpectancy | GNP | GNPOld | LocalName | GovernmentForm | HeadOfState | Capital | Code2 | +------+-------------+---------------+-----------------+-------------+-----------+------------+----------------+------------+------------+-------------+----------------------+-------------------------+---------+-------+ @@ -119,7 +119,7 @@ SELECT COUNT(*) AS Japanese FROM countrylanguage WHERE Language = "Japanese"; **出力** -```txt +```html +----------+ | Japanese | +----------+ @@ -142,7 +142,7 @@ SELECT Continent, COUNT(*) FROM country GROUP BY Continent; **出力** -```txt +```html +---------------+----------+ | Continent | COUNT(*) | +---------------+----------+ @@ -173,7 +173,7 @@ SELECT country.Name AS Country, city.Name AS Capital FROM country JOIN city ON c **出力** -```txt +```html +---------------------------------------+------------------------------------+ | Country | Capital | +---------------------------------------+------------------------------------+ @@ -212,7 +212,7 @@ SELECT * FROM country WHERE Continent IN ("North America", "South America"); **出力** -```txt +```html +------+----------------------------------+---------------+-----------------+-------------+-----------+------------+----------------+------------+------------+-------------------------------------+----------------------------------------------+--------------------------------------+---------+-------+ | Code | Name | Continent | Region | SurfaceArea | IndepYear | Population | LifeExpectancy | GNP | GNPOld | LocalName | GovernmentForm | HeadOfState | Capital | Code2 | +------+----------------------------------+---------------+-----------------+-------------+-----------+------------+----------------+------------+------------+-------------------------------------+----------------------------------------------+--------------------------------------+---------+-------+ @@ -254,7 +254,7 @@ SELECT * FROM country WHERE Name = "traP"; **出力** -```txt +```html +------+------+-----------+--------------+-------------+-----------+------------+----------------+------+--------+-----------+-------------------------+-------------+---------+-------+ | Code | Name | Continent | Region | SurfaceArea | IndepYear | Population | LifeExpectancy | GNP | GNPOld | LocalName | GovernmentForm | HeadOfState | Capital | Code2 | +------+------+-----------+--------------+-------------+-----------+------------+----------------+------+--------+-----------+-------------------------+-------------+---------+-------+ @@ -285,7 +285,7 @@ SELECT * FROM country WHERE Code = "TRP"; **出力** -```txt +```html +------+------+-----------+--------------+-------------+-----------+------------+----------------+------+--------+-----------+-------------------------+-------------+---------+-------+ | Code | Name | Continent | Region | SurfaceArea | IndepYear | Population | LifeExpectancy | GNP | GNPOld | LocalName | GovernmentForm | HeadOfState | Capital | Code2 | +------+------+-----------+--------------+-------------+-----------+------------+----------------+------+--------+-----------+-------------------------+-------------+---------+-------+ @@ -314,7 +314,7 @@ SELECT * FROM country WHERE Code = "TRP"; **出力** -```txt +```html Empty set (0.00 sec) ``` @@ -336,7 +336,7 @@ SELECT country.Name, city.Name FROM country LEFT JOIN city ON country.Code = cit **出力** -```txt +```html +----------------------------------------------+-----------------------------------+ | Name | Name | +----------------------------------------------+-----------------------------------+ @@ -376,7 +376,7 @@ SELECT RANK() OVER (ORDER BY Population DESC) AS Ranking, Name, Population FROM **出力** -```txt +```html +---------+--------------------+------------+ | Ranking | Name | Population | +---------+--------------------+------------+ @@ -412,7 +412,7 @@ SELECT Name, Continent, Region, Population FROM country WHERE Code = (SELECT Cou **出力** -```txt +```html +---------+-----------+----------------+------------+ | Name | Continent | Region | Population | +---------+-----------+----------------+------------+ @@ -442,7 +442,7 @@ ORDER BY Speakers DESC LIMIT 10; **出力** -```txt +```html +---------+------------+------------------+ | Ranking | Language | Speakers | +---------+------------+------------------+ diff --git a/docs/chapter1/section4/3_go_and_db.md b/docs/chapter1/section4/3_go_and_db.md index 6125c2d4..d30bd074 100644 --- a/docs/chapter1/section4/3_go_and_db.md +++ b/docs/chapter1/section4/3_go_and_db.md @@ -44,7 +44,7 @@ export DB_DATABASE="world" 今回は手元で動いているデータベースを使うのでパスワードなどが知られても問題ありませんが、実際には環境変数など外部の人に知られたくない、GitHub などに上げたくないファイルもあります。そのような場合は、`.gitignore`というファイルを使うことで特定のファイルやフォルダを Git 管理の対象外にできます。`.gitignore`ファイルの最後に`.env`を追記しましょう。 -```txt +```html ... # Go workspace file go.work @@ -76,7 +76,7 @@ $ go run main.go 出力はこのようになります。 -```txt +```html connected Tokyoの人口は7980230人です ``` @@ -124,7 +124,7 @@ $ go run main.go {都市の名前} <<< @/chapter1/section4/src/select.go#main{27 go:line-numbers} 以下のように日本の都市一覧を取得できます。 -```txt +```html connected 日本の都市一覧 都市名: Tokyo, 人口: 7980230