{"id":29311529,"url":"https://github.com/marta-barea/training-centers-sql","last_synced_at":"2025-07-31T03:34:22.773Z","repository":{"id":301012726,"uuid":"1007888526","full_name":"Marta-Barea/training-centers-sql","owner":"Marta-Barea","description":"An SQL project built around a fictional training center database, used to explore essential query techniques and database structures with MySQL.","archived":false,"fork":false,"pushed_at":"2025-06-24T17:49:52.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-24T18:41:46.563Z","etag":null,"topics":["mysql","mysql-database","sql"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Marta-Barea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-24T17:30:19.000Z","updated_at":"2025-06-24T17:49:56.000Z","dependencies_parsed_at":"2025-06-24T18:41:59.076Z","dependency_job_id":"43725cb5-91cd-46c5-8cb1-7296c1ac399e","html_url":"https://github.com/Marta-Barea/training-centers-sql","commit_stats":null,"previous_names":["marta-barea/training-centers-sql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Marta-Barea/training-centers-sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marta-Barea%2Ftraining-centers-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marta-Barea%2Ftraining-centers-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marta-Barea%2Ftraining-centers-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marta-Barea%2Ftraining-centers-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marta-Barea","download_url":"https://codeload.github.com/Marta-Barea/training-centers-sql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marta-Barea%2Ftraining-centers-sql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264040974,"owners_count":23548077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql","mysql-database","sql"],"created_at":"2025-07-07T08:15:04.418Z","updated_at":"2025-07-07T08:15:07.650Z","avatar_url":"https://github.com/Marta-Barea.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL Project - Training Center Database\n\nThis repository contains an SQL project built around a fictional **training center database**, used to explore essential query techniques and database structures with MySQL.\n\n---\n\n# How to use\n\n1. Clone the repository\n\n```bash\ngit clone https://github.com/yourusername/trining-ceneters-sql.git\ncd trining-ceneters-sql\n```\n\n2. Set your credentials in .env\n\nCreate a file named `.env` with your database credentials:\n\n```dotenv\nMYSQL_ROOT_PASSWORD=your_password\nMYSQL_PORT=mysql_port_here\nMYSQL_HOST=127.0.0.1\nMYSQL_DATABASE=training_centers\nMYSQL_USER=your_user\nMYSQL_PASSWORD=your_password\n```\n3. Start de Project\n\nMake sure [Docker](https://www.docker.com) is running, then run:\n\n```bash\ndocker-compose up -d\nmake all-insert\n\n```\nThis will:\n\n- Launch a MySQL 8.0 container\n- Create the database\n- Generate the schema\n- Insert fictional data\n- Run all queries in `queries/`\n- Export results as .csv files in `results/`\n\n# Requirements\n\n- [Docker](https://www.docker.com/products/docker-desktop) \n- [Docker Compose](https://docs.docker.com/compose/) \n- `make`(preinstalled on macOS/Linux)\n\n# Project Structure\n\n```\ntraining-centers-sql/\n├── .env                    \n├── .gitignore\n├── .dockerignore    \n├── Makefile\n├── docker-composo.yaml                    \n├── README.md        \n├── schema/\n│   ├── create_tables.sql\n│   ├── insert_sample_data.sql\n│   └── load_data.sql\n├── data/\n│   ├── centers.csv\n│   └── courses.csv\n├── queries/\n│   ├── 01_active_courses.sql\n│   ├── 02_distinct_categories.sql\n│   ├── ...\n└── results/\n    ├── 01_active_courses.csv\n    ├── 02_distinct_categories.csv\n    └── ...\n```\n# Queries Overview\n\n| Query                                  | Description                                                                 |\n|----------------------------------------|-----------------------------------------------------------------------------|\n| `01_cheapest_course.sql`               | Selects courses with a defined price, sorted ascendingly                   |\n| `02_distinct_categories.sql`           | Lists unique course categories                                             |\n| `03_courses_by_level_and_duration.sql`              | Filters beginner/intermediate courses with 20–40 hours                     |\n| `04_courses_with_missing_prices.sql`                | Selects courses where price is not null                                    |\n| `05_courses_related_to_sql.sql`              | Finds courses with \"SQL\" in their name                                     |\n| `06_price_categories.sql`              | Categorizes price ranges using CASE WHEN                                   |\n| `07_courses_under_150_or_free.sql`     | Filters courses under 150 or with free label                               |\n| `08_duration_in_days.sql`              | Converts course hours to days (8h/day assumption)                          |\n| `09_filter_by_category_and_level.sql`  | Selects non-advanced courses in specific categories                        |\n| `10_courses_with_safe_prices.sql`      | Uses COALESCE to display 'Pending' for null prices                         |\n| `11_avg_price_by_category.sql`         | Calculates average course price per category                               |\n| `12_courses_count_by_level.sql`         | Counts how many entries there are per course level                          |\n| `13_avg_duration_by_center.sql`        | Calculates average course duration by training center                      |\n| `14_categories_with_multiple_courses.sql`| Finds categories offering two or more courses                            |\n| `15_centers_with_multiple_courses.sql` | Finds centers offering at least one course                                 |\n| `16_avg_price_center.sql`              | Calculates average course price per center                                 |\n| `17_data_categories_multiple_courses.sql`| Finds categories with multiple \"Data\"-related courses                     |\n| `18_intermediate_hours_by_center.sql`  | Sums duration of Intermediate-level courses per center                     |\n| `19_course_levels_per_center.sql`      | Counts how many courses each center offers per level                       |\n| `20_centers_avg_price_above_100.sql`   | Lists centers where the average course price exceeds 100                   |\n\n# Notes \n\nAll data is fictional and anonymized.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarta-barea%2Ftraining-centers-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarta-barea%2Ftraining-centers-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarta-barea%2Ftraining-centers-sql/lists"}