{"id":22379789,"url":"https://github.com/fortunewalla/air-cargo","last_synced_at":"2026-04-18T17:01:42.827Z","repository":{"id":207529136,"uuid":"719470392","full_name":"fortunewalla/air-cargo","owner":"fortunewalla","description":"Air Cargo is an aviation company that provides air transportation services for passengers and freight. Airlines dataset in the form of CSV, database, dashboard using Tableau, PowerBI \u0026 MS Excel.","archived":false,"fork":false,"pushed_at":"2023-11-26T14:05:53.000Z","size":143,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T19:14:33.263Z","etag":null,"topics":["air-cargo","airlines","analysis","aviation","cargo","csv","dashboard","database","dataset","excel","microsoft","msexcel","mssql","mysql","postgresql","powerbi","sql"],"latest_commit_sha":null,"homepage":"","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/fortunewalla.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}},"created_at":"2023-11-16T08:32:59.000Z","updated_at":"2025-02-10T20:44:19.000Z","dependencies_parsed_at":"2023-11-26T15:23:33.192Z","dependency_job_id":"b0bd5697-ecc7-48d5-8457-5273ca568f88","html_url":"https://github.com/fortunewalla/air-cargo","commit_stats":null,"previous_names":["fortunewalla/air_cargo","fortunewalla/air-cargo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fortunewalla/air-cargo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunewalla%2Fair-cargo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunewalla%2Fair-cargo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunewalla%2Fair-cargo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunewalla%2Fair-cargo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fortunewalla","download_url":"https://codeload.github.com/fortunewalla/air-cargo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunewalla%2Fair-cargo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31976805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T16:27:12.723Z","status":"ssl_error","status_checked_at":"2026-04-18T16:27:11.140Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["air-cargo","airlines","analysis","aviation","cargo","csv","dashboard","database","dataset","excel","microsoft","msexcel","mssql","mysql","postgresql","powerbi","sql"],"created_at":"2024-12-04T23:11:26.528Z","updated_at":"2026-04-18T17:01:42.800Z","avatar_url":"https://github.com/fortunewalla.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Air Cargo Database\n\n## Introduction\nThe goal is to provide a database ready version of the Air Cargo dataset. \n\n\n\n## Background\n\nThis is the individual SQL Project for the BCG Rise Course.\n\nProject Name : Air Cargo Analysis\n\n### DESCRIPTION\n\nAir Cargo is an aviation company that provides air transportation services for passengers and freight. Air Cargo uses its aircraft to provide different services with the help of partnerships or alliances with other airlines. The company wants to prepare reports on regular passengers, busiest routes, ticket sales details, and other scenarios to improve the ease of travel and booking for customers.\n\n### Project Objective:\n\nYou, as a DBA expert, need to focus on identifying the regular customers to provide offers, analyze the busiest route which helps to increase the number of aircraft required and prepare an analysis to determine the ticket sales details. This will ensure that the company improves its operability and becomes more customer-centric and a favorable choice for air travel.\n\nNote: You must download the dataset from the course resource section in the LMS and create the tables to perform the above objective.\n\n### Dataset description:\n\nCustomer: Contains the information of customers\n\n    customer_id — ID of the customer (PK)\n    first_name — First name of the customer\n    last_name — Last name of the customer\n    date_of_birth — Date of birth of the customer\n    gender — Gender of the customer\n\npassengers_on_flights: Contains information about the travel details\n\n    aircraft_id — ID of each aircraft in a brand (PK)\n    route_id — Route ID of from and to location (FK)\n    customer_id — ID of the customer (FK)\n    depart — Departure place from the airport\n    arrival — Arrival place in the airport\n    seat_num — Unique seat number for each passenger\n    class_id — ID of travel class\n    travel_date — Travel date of each passenger\n    flight_num — Specific flight number for each route\n\nticket_details: Contains information about the ticket details\n\n    p_date — Ticket purchase date\n    customer_id — ID of the customer (FK)\n    aircraft_id — ID of each aircraft in a brand (FK)\n    class_id — ID of travel class\n    no_of_tickets — Number of tickets purchased\n    a_code — Code of each airport\n    price_per_ticket — Price of a ticket\n    brand — Aviation service provider for each aircraft\n\nroutes: Contains information about the route details\n\n    Route_id — Route ID of from and to location (PK)\n    Flight_num — Specific flight number for each route\n    Origin_airport — Departure location\n    Destination_airport — Arrival location\n    Aircraft_id — ID of each aircraft in a brand\n    Distance_miles — Distance between departure and arrival location\n\n## Database creation\n\n\n#### Dataset Files\n\n`customer.csv`\n\n```\ncustomer_id,first_name,last_name,date_of_birth,gender\n1,Julie,Sam,12-01-1989,F\n2,Steve,Ryan,03-04-1983,M\n3,Morris,Lois,09-12-1993,M\n4,Cathenna,Emily,14-09-1977,F\n5,Aaron,Kim,18-02-1991,M\n```\n\n`passengers_on_flights.csv`\n\n```\ncustomer_id,aircraft_id,route_id,depart,arrival,seat_num,class_id,travel_date,flight_num\n2,A321,34,CRW,COD,01B,Bussiness,26-01-2019,1117\n2,767-301ER,4,JFK,LAX,01E,Economy,02-09-2018,1114\n1,ERJ142,9,DEN,LAX,01EP,Economy Plus,26-12-2019,1119\n1,CRJ900,30,BUR,STT,01FC,First Class,04-11-2018,1140\n5,767-301ER,12,ABI,ADK,02B,Bussiness,02-07-2018,1122\n```\n\n`routes.csv`\n\n```\nroute_id,flight_num,origin_airport,destination_airport,aircraft_id,distance_miles\n1,1111,EWR,HNL,767-301ER,4962\n2,1112,HNL,EWR,767-301ER,4962\n3,1113,EWR,LHR,A321,3466\n4,1114,JFK,LAX,767-301ER,2475\n```\n\n`ticket_details`\n\n```\np_date,customer_id,aircraft_id,class_id,no_of_tickets,a_code,Price_per_ticket,brand\n26-12-2018,27,767-301ER,Economy,1,DAL,130,Emirates\n02-02-2020,22,ERJ142,Economy Plus,1,AGB,220,Jet Airways\n03-03-2020,21,CRJ900,Bussiness,1,BOH,490,Bristish Airways\n04-04-2020,4,767-301ER,First Class,1,AGB,390,Emirates\n```\n\n\n#### Data Checks\n\nWe check the files for 4 types of errors:\n\n1. Missing data\n2. Duplicate data\n3. Improper data\n4. Software-based errors\n\n\n`customer.csv`\n\nRaw form of the data:\n\n```\ncustomer_id,first_name,last_name,date_of_birth,gender\n1,Julie,Sam,12-01-1989,F\n2,Steve,Ryan,03-04-1983,M\n3,Morris,Lois,09-12-1993,M\n4,Cathenna,Emily,14-09-1977,F\n5,Aaron,Kim,18-02-1991,M\n```\n\nData after opening the CSV in MS Excel:\n\n```\ncustomer_id\tfirst_name\tlast_name\tdate_of_birth\tgender\n1\tJulie\tSam\t12/1/1989\tF\n2\tSteve\tRyan\t3/4/1983\tM\n3\tMorris\tLois\t9/12/1993\tM\n4\tCathenna\tEmily\t14-09-1977\tF\n5\tAaron\tKim\t18-02-1991\tM\n```\n\nThe reason is that the date format of the CSV (DD-MM-YYYY) differs from the data format that Excel understand for United States region/locale (MM/DD/YYYY).\n\nSolution: Before importing data, define the date format according to the CSV format first.\n\n\n`passengers_on_flights.csv`\n\nRaw form of the data:\n\n\n```\ncustomer_id,aircraft_id,route_id,depart,arrival,seat_num,class_id,travel_date,flight_num\n2,A321,34,CRW,COD,01B,Bussiness,26-01-2019,1117\n2,767-301ER,4,JFK,LAX,01E,Economy,02-09-2018,1114\n1,ERJ142,9,DEN,LAX,01EP,Economy Plus,26-12-2019,1119\n1,CRJ900,30,BUR,STT,01FC,First Class,04-11-2018,1140\n5,767-301ER,12,ABI,ADK,02B,Bussiness,02-07-2018,1122\n```\n\nData after opening the CSV in MS Excel:\n\n```\ncustomer_id\taircraft_id\troute_id\tdepart\tarrival\tseat_num\tclass_id\ttravel_date\tflight_num\n2\tA321\t34\tCRW\tCOD\t01B\tBussiness\t26-01-2019\t1117\n2\t767-301ER\t4\tJFK\tLAX\t01E\tEconomy\t2/9/2018\t1114\n1\tERJ142\t9\tDEN\tLAX\t01EP\tEconomy Plus\t26-12-2019\t1119\n1\tCRJ900\t30\tBUR\tSTT\t01FC\tFirst Class\t4/11/2018\t1140\n5\t767-301ER\t12\tABI\tADK\t02B\tBussiness\t2/7/2018\t1122\n5\tERJ142\t18\tANI\tBGR\t02E\tEconomy\t6/5/2020\t1128\n```\n\nThe reason is that the date format of the CSV (DD-MM-YYYY) differs from the data format that Excel understand for United States region/locale (MM/DD/YYYY).\n\nSolution: Before importing data, define the date format according to the CSV format first.\n\n`routes.csv`\n\nRaw form of the data:\n\n\n```\nroute_id,flight_num,origin_airport,destination_airport,aircraft_id,distance_miles\n1,1111,EWR,HNL,767-301ER,4962\n2,1112,HNL,EWR,767-301ER,4962\n3,1113,EWR,LHR,A321,3466\n4,1114,JFK,LAX,767-301ER,2475\n```\n\nData after opening the CSV in MS Excel:\n\n```\nroute_id\tflight_num\torigin_airport\tdestination_airport\taircraft_id\tdistance_miles\n1\t1111\tEWR\tHNL\t767-301ER\t4962\n2\t1112\tHNL\tEWR\t767-301ER\t4962\n3\t1113\tEWR\tLHR\tA321\t3466\n4\t1114\tJFK\tLAX\t767-301ER\t2475\n5\t1115\tLAX\tJFK\t767-301ER\t2475\n\n```\n\nRoute no. 11 is missing.\n\nBoth match\n\n`ticket_details`\n\nRaw form of the data:\n\n\n```\np_date,customer_id,aircraft_id,class_id,no_of_tickets,a_code,Price_per_ticket,brand\n26-12-2018,27,767-301ER,Economy,1,DAL,130,Emirates\n02-02-2020,22,ERJ142,Economy Plus,1,AGB,220,Jet Airways\n03-03-2020,21,CRJ900,Bussiness,1,BOH,490,Bristish Airways\n04-04-2020,4,767-301ER,First Class,1,AGB,390,Emirates\n```\n\nData after opening the CSV in MS Excel:\n\n```\np_date\tcustomer_id\taircraft_id\tclass_id\tno_of_tickets\ta_code\tPrice_per_ticket\tbrand\n26-12-2018\t27\t767-301ER\tEconomy\t1\tDAL\t130\tEmirates\n2/2/2020\t22\tERJ142\tEconomy Plus\t1\tAGB\t220\tJet Airways\n3/3/2020\t21\tCRJ900\tBussiness\t1\tBOH\t490\tBristish Airways\n4/4/2020\t4\t767-301ER\tFirst Class\t1\tAGB\t390\tEmirates\n\n```\n\n\n\nThe reason is that the date format of the CSV (DD-MM-YYYY) differs from the data format that Excel understand for United States region/locale (MM/DD/YYYY).\n\nSolution: Before importing data, define the date format according to the CSV format first.\n\nAlso spelling mistake \"Bristish\" perhaps? We will correct it to \"British\".\n\nAlso spelling mistake \"Bussiness\" perhaps? We will correct it to \"Business\".\n\nAlso \"Price_per_ticket\" must be corrected to \"price_per_ticket\"\n\n\n#### Database\n\n1) Load all four files into a single Excel .xls files with dates in US Format.\n\nSince the date is in format DD-MM-YYYY, we change Date Type according to Locale. Selected en-IN as the transformation locale \u0026 this changes the date into MM/DD/YYYY which is default for US Locale.\n \n2) Correct errors within Excel\n\n* Changed `Price_per_ticket` to `price_per_ticket`\n* Changed `Bussiness` to `Business`\n* Changed `Bristish Airways` to `British Airways`\n\n3) Save the corrected CSV files.\n\nFrom the Single Excel, export each sheet to its respective CSV file. \n\n`ticket_details.csv` has an extra `\\r` character attached to the end of the line. This was found using Notepad++ \u0026 cleaned up by removing it using replace string.\n\n4) route_id 11 is missing.\n\n5) Only the `customer` and `routes` seems to have unique ID entries, the rest of the tables are mixed information rows.\n\n6) Design database schema\n\nObservations:\n\nLet's assign the Primary Keys (PK) \u0026 Foreign Keys (FK) as mentioned below.\n\ncustomer: customer_id (PK),first_name,last_name,date_of_birth,gender\npassengers_of_flights: customer_id(FK),aircraft_id,route_id(FK),depart,arrival,seat_num,class_id,travel_date,flight_num\nroutes: route_id(PK),flight_num,origin_airport,destination_airport,aircraft_id,distance_miles\nticket_details: p_date,customer_id(FK),aircraft_id,class_id,no_of_tickets,a_code,price_per_ticket,brand\n\n7) Since we will not be updating any data, foreign keys are not really required for our work but it is good to have those relationships for learning.\n\n\n## Installation\n\nAfter taking all the above design considerations, we have created two files, one to create the schema \u0026 the other to import the data.\n\nIn mysql prompt \n\nUsing\n`source /path/to/file/aircargo_schema.sql`\n\n`source /path/to/file/aircargo_data.sql`\n\nOr if you prefer using database imported script:\n\n`mysqldump -u user -ppasss aircargo \u003e aircargo.sql`\n\n`source /path/to/file/aircargo.sql`\n\nShould there be any permission errors while importing the data, add the following to the `my.ini` file.\n\n```ini\n[mysql]\ndefault-character-set=utf8mb4\nlocal-infile=1\n\n[mysqld]\nsecure-file-priv=''\nlocal-infile=1\n```\n\n\nThese were the questions given for the project\n\n### Questions to answer.\n\n1. Create an ER diagram for the given airlines database.\n\n2. Write a query to create route_details table using suitable data types for the fields, such as route_id, flight_num, origin_airport, destination_airport, aircraft_id, and distance_miles. Implement the check constraint for the flight number and unique constraint for the route_id fields. Also, make sure that the distance miles field is greater than 0.\n\n3. Write a query to display all the passengers (customers) who have traveled in routes 01 to 25. Take data from the passengers_on_flights table.\n\n4. Write a query to identify the number of passengers and total revenue in business class from the ticket_details table.\n\n5. Write a query to display the full name of the customer by extracting the first name and last name from the customer table.\n\n6. Write a query to extract the customers who have registered and booked a ticket. Use data from the customer and ticket_details tables.\n\n7. Write a query to identify the customer’s first name and last name based on their customer ID and brand (Emirates) from the ticket_details table.\n\n8. Write a query to identify the customers who have traveled by Economy Plus class using Group By and Having clause on the passengers_on_flights table.\n\n9. Write a query to identify whether the revenue has crossed 10000 using the IF clause on the ticket_details table.\n\n10. Write a query to create a view with only business class customers along with the brand of airlines.\n\n11. Write a query to create a stored procedure to get the details of all passengers flying between a range of routes defined in run time. Also, return an error message if the table doesn’t exist.\n\n12. Write a query to create a stored procedure that extracts all the details from the routes table where the traveled distance is more than 2000 miles.\n\n13. Write a query to create a stored procedure that groups the distance traveled by each flight into three categories. The categories are, short distance travel (SDT) for \u003e=0 AND \u003c= 2000 miles, intermediate distance travel (IDT) for \u003e2000 AND \u003c=6500, and long-distance travel (LDT) for \u003e6500.\n\n\n#### Sources \n\nThis was inspired by the course project repo of Jonathan James Jie [1]. \n\n[1] https://github.com/JonathanJamesJie/BCG-SQL-Air-Cargo\n\n[2] https://github.com/kaushik-prasad-dey/sql_data_science_air_cargo_analysis Contains .mwb file. Exported .sql file based on the .mwb\n\n[3] https://github.com/Ad232164/Air-Cargo-Analysis-SQL-project\n\n[4] https://github.com/prajwal-mv/Air-Cargo-Analysis\n\n[5] https://github.com/Satyam1391/SQL_Projects\n\n[6] https://www.linkedin.com/posts/satyam-baviskar-b9891625a_sql-dataanalysis-businessintelligence-activity-7092112493895913473-pUub\n\n[7] https://www.linkedin.com/posts/tushar-jakhalekar-b675181ab_air-cargo-analysis-mysql-activity-7054132881337528320-U_F-\n\n[8]  https://github.com/shubh-2698/AirCargo-Analysis\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortunewalla%2Fair-cargo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffortunewalla%2Fair-cargo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortunewalla%2Fair-cargo/lists"}