{"id":23084673,"url":"https://github.com/iankitnegi/hackerranksqlvault","last_synced_at":"2025-06-17T10:11:19.166Z","repository":{"id":267128260,"uuid":"900336438","full_name":"iankitnegi/HackerRankSQLVault","owner":"iankitnegi","description":"A repository of SQL solutions to HackerRank challenges, featuring well-documented queries and insights to enhance SQL skills. Perfect for learning and practice!","archived":false,"fork":false,"pushed_at":"2024-12-09T13:24:03.000Z","size":480,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T14:46:29.759Z","etag":null,"topics":["mysql","sql"],"latest_commit_sha":null,"homepage":"https://www.hackerrank.com/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iankitnegi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-12-08T14:19:19.000Z","updated_at":"2024-12-09T13:24:06.000Z","dependencies_parsed_at":"2024-12-16T16:42:07.158Z","dependency_job_id":null,"html_url":"https://github.com/iankitnegi/HackerRankSQLVault","commit_stats":null,"previous_names":["iankitnegi/hackerranksqlvault"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iankitnegi/HackerRankSQLVault","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iankitnegi%2FHackerRankSQLVault","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iankitnegi%2FHackerRankSQLVault/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iankitnegi%2FHackerRankSQLVault/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iankitnegi%2FHackerRankSQLVault/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iankitnegi","download_url":"https://codeload.github.com/iankitnegi/HackerRankSQLVault/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iankitnegi%2FHackerRankSQLVault/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260336343,"owners_count":22993740,"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","sql"],"created_at":"2024-12-16T16:41:57.152Z","updated_at":"2025-06-17T10:11:14.152Z","avatar_url":"https://github.com/iankitnegi.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Welcome to my SQL problem-solving repository!**\n\nThis repository is dedicated to solving SQL challenges from [HackerRank](https://www.hackerrank.com/). Here, you’ll find:\n\n- **A variety of SQL problems**: From beginner to advanced levels, covering key concepts like SELECT queries, JOINs, subqueries, window functions, and more.\n- **Well-documented solutions**: Each solution includes a clear explanation of the approach and the query used to solve the problem.\n- **Learning-focused insights**: Perfect for anyone looking to strengthen their SQL skills or understand different problem-solving techniques.\n\n## Revising the Select Query I\nSELECT *  \nFROM city  \nWHERE countrycode LIKE 'USA' AND population\u003e100000;  \n\n## Revising the Select Query II  \nSELECT name  \nFROM city  \nWHERE countrycode LIKE 'USA' AND population\u003e120000;  \n\n## Select All\nSELECT *  \nFROM city;  \n\n## Select By ID\nSELECT *  \nFROM city  \nWHERE id = 1661;  \n\n## Japanese Cities' Attributes  \nSELECT *  \nFROM city  \nWHERE countrycode LIKE 'JPN';\n\n## Japanese Cities' Names\nSELECT name  \nFROM city  \nWHERE countrycode LIKE 'JPN';  \n\n## Weather Observation Station 1\nSELECT city, state  \nFROM station;  \n\n## Weather Observation Station 3\nSELECT DISTINCT city  \nFROM station  \nWHERE id%2=0;  \n\n## Weather Observation Station 4\nSELECT COUNT(city) - COUNT(DISTINCT city)  \nFROM station;  \n\n## Weather Observation Station 5\nSELECT city, LENGTH(city)  \nFROM station  \nWHERE LENGTH(city) = (  \n    SELECT MIN(LENGTH(city)) FROM station  \n)  \nORDER BY city  \nLIMIT 1;  \nSELECT city, LENGTH(city)  \nFROM station  \nWHERE LENGTH(city) = (  \n    SELECT MIN(LENGTH(city)) FROM station  \n)  \nORDER BY city  \nLIMIT 1;  \n\nOR  \n\n(SELECT city, LENGTH(city) AS city_len  \nFROM station  \nORDER BY LENGTH(city), city  \nLIMIT 1) UNION  \n(SELECT city, LENGTH(city) AS city_len  \nFROM station  \nORDER BY LENGTH(city) DESC, city  \nLIMIT 1 )  \n\n## Weather Observation Station 6\nSELECT DISTINCT city    \nFROM station    \nWHERE city LIKE 'a%' OR city LIKE 'e%' OR city LIKE 'i%' OR city LIKE 'o%' OR city LIKE 'u%';    \n\n## Weather Observation Station 7\nSELECT DISTINCT city  \nFROM station  \nWHERE RIGHT(city, 1) IN ('a', 'e', 'i', 'o', 'u');  \n\n## Weather Observation Station 8\nSELECT DISTINCT city    \nFROM station    \nWHERE LEFT(city, 1) IN ('a', 'e', 'i', 'o', 'u') AND RIGHT(city, 1) IN ('a', 'e', 'i', 'o', 'u');    \n\n## Weather Observation Station 9\nSELECT DISTINCT city    \nFROM station    \nWHERE LEFT(city, 1) NOT IN ('a', 'e', 'i', 'o', 'u');    \n\n## Weather Observation Station 10\nSELECT DISTINCT city    \nFROM station    \nWHERE RIGHT(city, 1) NOT IN ('a', 'e', 'i', 'o', 'u');    \n\n## Weather Observation Station 11\nSELECT DISTINCT city    \nFROM station    \nWHERE LEFT(city, 1) NOT IN ('a', 'e', 'i', 'o', 'u') OR RIGHT(city, 1) NOT IN ('a', 'e', 'i', 'o', 'u');    \n\n## Weather Observation Station 12\nSELECT DISTINCT city    \nFROM station    \nWHERE LEFT(city, 1) NOT IN ('a', 'e', 'i', 'o', 'u') AND RIGHT(city, 1) NOT IN ('a', 'e', 'i', 'o', 'u');    \n\n## Higher Than 75 Marks\nSELECT name    \nFROM students    \nWHERE marks\u003e75    \nORDER BY RIGHT(name, 3), id;    \n\n## Employee Names\nSELECT name    \nFROM employee    \nORDER BY name;    \n\n## Employee Salaries\nSELECT name    \nFROM employee    \nWHERE salary\u003e2000 AND months\u003c10    \nORDER BY employee_id;    \n\n## Type of Triangle    \nSELECT     \n    CASE    \n        WHEN A+B\u003eC AND B+C\u003eA AND A+C\u003eB THEN    \n            CASE    \n                WHEN A=B AND B=C AND C=A THEN \"Equilateral\"    \n                WHEN A=B OR B=C OR C=A THEN \"Isosceles\"    \n                ELSE \"Scalene\"    \n            END    \n        ELSE \"Not A Triangle\"    \n    END    \nFROM triangles;    \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiankitnegi%2Fhackerranksqlvault","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiankitnegi%2Fhackerranksqlvault","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiankitnegi%2Fhackerranksqlvault/lists"}