Just some fun. (And going for SQL Gold and Certs on Hacker Rank.)
Docker Compose:
docker compose up
Connection settings:
Host: localhost:3306
User: example
Password: example
Database: example
Execute SQL through the Docker Shell:
# Exec in and login
mysql --user=example --password=example lab
# Execute command
mysql> SELECT * FROM jsonexample;
mysql> exit
Execute supplied scripts:
mysql --user=example --password=example lab
mysql> source ./scripts/restart.sql
mysql> source ./scripts/HackerRank-Occupations.sql
mysql> source ./scripts/HackerRank-TypeOfTriangle.sql
mysql> source ./scripts/HackerRank-TopEarners.sql
mysql> source ./scripts/HackerRank-ThePADS.sql
mysql> source ./scripts/HackerRank-NewCompanies.sql
mysql> source ./scripts/HackerRank-WeatherStation8.sql
mysql> source ./scripts/HackerRank-WeatherStation18.sql
mysql> source ./scripts/HackerRank-WeatherStation19.sql
mysql> source ./scripts/HackerRank-WeatherStation20.sql
mysql> source ./scripts/HackerRank-Interviews.sql
mysql> source ./scripts/HackerRank-DrawTheTriangle1.sql
mysql> source ./scripts/HackerRank-DrawTheTriangle2.sql
mysql> source ./scripts/HackerRank-SymmetricPairs.sql
- MySQL 8.0 requires passing number of chars in the
VARCHAR
type. - MySQL 8.0
BEGIN
andEND
requiresDELIMITERS
. mysql> source
requires./
for file paths.- Uses
LIMIT
prepended notTOP
(per MSSQL). WITH
cannot be used with MySQL prior to8.0
(sadly, HackerRank uses MySQL versions<8.0
andWITH
queries will error out on the platform).