{"id":26045127,"url":"https://github.com/saurabh9136/netflix_project","last_synced_at":"2026-04-22T07:35:58.818Z","repository":{"id":280804149,"uuid":"943227462","full_name":"saurabh9136/netflix_project","owner":"saurabh9136","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-05T14:55:22.000Z","size":1579,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T15:35:56.985Z","etag":null,"topics":["postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"Python","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/saurabh9136.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":"2025-03-05T11:15:35.000Z","updated_at":"2025-03-05T14:55:25.000Z","dependencies_parsed_at":"2025-03-05T15:47:45.271Z","dependency_job_id":null,"html_url":"https://github.com/saurabh9136/netflix_project","commit_stats":null,"previous_names":["saurabh9136/netflix_sql_project","saurabh9136/netflix_project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/saurabh9136/netflix_project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurabh9136%2Fnetflix_project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurabh9136%2Fnetflix_project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurabh9136%2Fnetflix_project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurabh9136%2Fnetflix_project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saurabh9136","download_url":"https://codeload.github.com/saurabh9136/netflix_project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saurabh9136%2Fnetflix_project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32126174,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"online","status_checked_at":"2026-04-22T02:00:05.693Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["postgresql","sql"],"created_at":"2025-03-07T19:31:47.992Z","updated_at":"2026-04-22T07:35:58.788Z","avatar_url":"https://github.com/saurabh9136.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Netflix Data Analysis Projects\n![](https://github.com/najirh/netflix_sql_project/blob/main/logo.png)\n## 1. Netflix Advance SQL Analysis\nThis project analyzes Netflix data using SQL queries to extract insights about movies, genres, and user interactions.\n\n**Dataset Used:** `netflix_titles.csv`\n## Schema\n\n```sql\nDROP TABLE IF EXISTS netflix;\nCREATE TABLE netflix\n(\n    show_id      VARCHAR(5),\n    type         VARCHAR(10),\n    title        VARCHAR(250),\n    director     VARCHAR(550),\n    casts        VARCHAR(1050),\n    country      VARCHAR(550),\n    date_added   VARCHAR(55),\n    release_year INT,\n    rating       VARCHAR(15),\n    duration     VARCHAR(15),\n    listed_in    VARCHAR(250),\n    description  VARCHAR(550)\n);\n```\n\n## Business Problems and Solutions\n\n### 1. Count the Number of Movies vs TV Shows\n\n```sql\nSELECT \n    type,\n    COUNT(*)\nFROM netflix\nGROUP BY 1;\n```\n\n**Objective:** Determine the distribution of content types on Netflix.\n\n### 2. Find the Most Common Rating for Movies and TV Shows\n\n```sql\nWITH RatingCounts AS (\n    SELECT \n        type,\n        rating,\n        COUNT(*) AS rating_count\n    FROM netflix\n    GROUP BY type, rating\n),\nRankedRatings AS (\n    SELECT \n        type,\n        rating,\n        rating_count,\n        RANK() OVER (PARTITION BY type ORDER BY rating_count DESC) AS rank\n    FROM RatingCounts\n)\nSELECT \n    type,\n    rating AS most_frequent_rating\nFROM RankedRatings\nWHERE rank = 1;\n```\n\n**Objective:** Identify the most frequently occurring rating for each type of content.\n\n### 3. List All Movies Released in a Specific Year (e.g., 2020)\n\n```sql\nSELECT * \nFROM netflix\nWHERE release_year = 2020;\n```\n\n**Objective:** Retrieve all movies released in a specific year.\n\n### 4. Find the Top 5 Countries with the Most Content on Netflix\n\n```sql\nSELECT * \nFROM\n(\n    SELECT \n        UNNEST(STRING_TO_ARRAY(country, ',')) AS country,\n        COUNT(*) AS total_content\n    FROM netflix\n    GROUP BY 1\n) AS t1\nWHERE country IS NOT NULL\nORDER BY total_content DESC\nLIMIT 5;\n```\n\n**Objective:** Identify the top 5 countries with the highest number of content items.\n\n### 5. Identify the Longest Movie\n\n```sql\nSELECT \n    *\nFROM netflix\nWHERE type = 'Movie'\nORDER BY SPLIT_PART(duration, ' ', 1)::INT DESC;\n```\n\n**Objective:** Find the movie with the longest duration.\n\n### 6. Find Content Added in the Last 5 Years\n\n```sql\nSELECT *\nFROM netflix\nWHERE TO_DATE(date_added, 'Month DD, YYYY') \u003e= CURRENT_DATE - INTERVAL '5 years';\n```\n\n**Objective:** Retrieve content added to Netflix in the last 5 years.\n\n### 7. Find All Movies/TV Shows by Director 'Rajiv Chilaka'\n\n```sql\nSELECT *\nFROM (\n    SELECT \n        *,\n        UNNEST(STRING_TO_ARRAY(director, ',')) AS director_name\n    FROM netflix\n) AS t\nWHERE director_name = 'Rajiv Chilaka';\n```\n\n**Objective:** List all content directed by 'Rajiv Chilaka'.\n\n### 8. List All TV Shows with More Than 5 Seasons\n\n```sql\nSELECT *\nFROM netflix\nWHERE type = 'TV Show'\n  AND SPLIT_PART(duration, ' ', 1)::INT \u003e 5;\n```\n\n**Objective:** Identify TV shows with more than 5 seasons.\n\n### 9. Count the Number of Content Items in Each Genre\n\n```sql\nSELECT \n    UNNEST(STRING_TO_ARRAY(listed_in, ',')) AS genre,\n    COUNT(*) AS total_content\nFROM netflix\nGROUP BY 1;\n```\n\n**Objective:** Count the number of content items in each genre.\n\n### 10.Find each year and the average numbers of content release in India on netflix. \nreturn top 5 year with highest avg content release!\n\n```sql\nSELECT \n    country,\n    release_year,\n    COUNT(show_id) AS total_release,\n    ROUND(\n        COUNT(show_id)::numeric /\n        (SELECT COUNT(show_id) FROM netflix WHERE country = 'India')::numeric * 100, 2\n    ) AS avg_release\nFROM netflix\nWHERE country = 'India'\nGROUP BY country, release_year\nORDER BY avg_release DESC\nLIMIT 5;\n```\n\n**Objective:** Calculate and rank years by the average number of content releases by India.\n\n### 11. List All Movies that are Documentaries\n\n```sql\nSELECT * \nFROM netflix\nWHERE listed_in LIKE '%Documentaries';\n```\n\n**Objective:** Retrieve all movies classified as documentaries.\n\n### 12. Find All Content Without a Director\n\n```sql\nSELECT * \nFROM netflix\nWHERE director IS NULL;\n```\n\n**Objective:** List content that does not have a director.\n\n### 13. Find How Many Movies Actor 'Salman Khan' Appeared in the Last 10 Years\n\n```sql\nSELECT * \nFROM netflix\nWHERE casts LIKE '%Salman Khan%'\n  AND release_year \u003e EXTRACT(YEAR FROM CURRENT_DATE) - 10;\n```\n\n**Objective:** Count the number of movies featuring 'Salman Khan' in the last 10 years.\n\n### 14. Find the Top 10 Actors Who Have Appeared in the Highest Number of Movies Produced in India\n\n```sql\nSELECT \n    UNNEST(STRING_TO_ARRAY(casts, ',')) AS actor,\n    COUNT(*)\nFROM netflix\nWHERE country = 'India'\nGROUP BY actor\nORDER BY COUNT(*) DESC\nLIMIT 10;\n```\n\n**Objective:** Identify the top 10 actors with the most appearances in Indian-produced movies.\n\n### 15. Categorize Content Based on the Presence of 'Kill' and 'Violence' Keywords\n\n```sql\nSELECT \n    category,\n    COUNT(*) AS content_count\nFROM (\n    SELECT \n        CASE \n            WHEN description ILIKE '%kill%' OR description ILIKE '%violence%' THEN 'Bad'\n            ELSE 'Good'\n        END AS category\n    FROM netflix\n) AS categorized_content\nGROUP BY category;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaurabh9136%2Fnetflix_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaurabh9136%2Fnetflix_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaurabh9136%2Fnetflix_project/lists"}