Exploring Accident Database (Data Analysis by SQL)

Поделиться
HTML-код
  • Опубликовано: 25 июл 2024
  • .
    I used Microsoft SQL Server Management Studio to conduct exploratory data analysis for the accident database. During this project, I tried to run SQL queries ranging from simple to most challenging and complex to answer 8 different questions.
    -------------------------------------------------------------------
    You can find each part of this video here:
    🕒 00:00 Introduction to Project
    🕒 00:49 Data
    🕒 03:46 Create Database and Tables
    🕒 05:26 Question 1
    🕒 08:53 Question 2
    🕒 11:18 Question 3
    🕒 15:19 Question 4
    🕒 22:17 Question 5
    🕒 28:01 Question 6
    🕒 30:32 Question 7
    🕒 37:29 Question 8
    🧷 If you like, you can walk through the project's materials:
    mehrdaad.wixsite.com/portfoli...
    -------------------------------------------------------------------
    Also, you can find more videos like this in the below playlist:
    ✔️ • Domain: Exploratory Da...
    ✔️ • SQL
    -------------------------------------------------------------------
    I'd be pleased if you see my profile:
    🔶 mehrdaad.wixsite.com/portfolio
    🔶 github.com/M3hrdad-Dehghan
    🔶 / mehrdad-dehghan

Комментарии • 72

  • @safakv60
    @safakv60 7 месяцев назад

    Thank you for all your efforts on the channel.

  • @aliwow7874
    @aliwow7874 11 месяцев назад +1

    Thank you for doing such a great tutorial 🎉

  • @fluffyhoneytina
    @fluffyhoneytina 24 дня назад

    i like watching you solve the questions, more videos please xoxo from california

  • @piyushsingh6084
    @piyushsingh6084 Год назад

    you are just amazing.!! thanks

  • @sasitpiasai8152
    @sasitpiasai8152 9 месяцев назад +3

    Is a good SQL tutorial for beginner. thank you

  • @RafiqulIslam-dv9cu
    @RafiqulIslam-dv9cu Год назад

    Fantastic Work Boss.

  • @uwayojacques317
    @uwayojacques317 Месяц назад

    Thank you for giving free knowledge to the world

  • @Sajid10109
    @Sajid10109 8 месяцев назад

    Very use full project Dear

  • @PujiPamungkas-ko4db
    @PujiPamungkas-ko4db Год назад

    I just found your works. 👍

  • @dealnbiz7090
    @dealnbiz7090 2 месяца назад

    Best video on topic

  • @uzi110
    @uzi110 7 месяцев назад +2

    question 5
    easy Understanding Query
    select WeatherConditions , count(WeatherConditions) as TotalAccident
    from accident
    where Severity = 'Fatal'
    group by WeatherConditions
    order by TotalAccident desc

  • @ebenezeramponsahbediako8373
    @ebenezeramponsahbediako8373 10 дней назад

    Which symbol did you put beside the WHERE function and Severity variable to make them inactive?

  • @ashutoshpandey9105
    @ashutoshpandey9105 6 месяцев назад

    Hey, nice tutorial, I am doing this for my portfolio project. DO I need to save the results of queries as well? Or just codes will be enough?

    • @mehrdad_analyst
      @mehrdad_analyst  6 месяцев назад

      No need to save the query since all queries are stored in a log.

  • @dapoadimula3167
    @dapoadimula3167 8 месяцев назад

    The left-hand column in the vehicle table cannot be imported with the bit or tinyint datatype. Please note that I am using SQL Server Management Studio (SSMS) for my database

    • @mehrdad_analyst
      @mehrdad_analyst  7 месяцев назад

      please make sure you don't change the data type of variables

  • @manojparida9040
    @manojparida9040 9 месяцев назад +1

    Good job....
    While i import the vehicle file in MySQL, it shows row imported failed due to data truncated for column accidentindex at row 1 and 1265.

    • @mehrdad_analyst
      @mehrdad_analyst  9 месяцев назад +1

      Try Microsoft SQL Management Studio instead of MySQL

  • @navaneethcm8377
    @navaneethcm8377 8 месяцев назад +1

    First of all, thank you for the video. I am new at this and was searching for a project to do to learn more and start building a resume. But I have encountered a problem while importing the flat file 'vehicle'. It says -
    The given value 'No' of type String from the data source cannot be converted to type bit for Column 4 [LeftHand]. (Microsoft.Data.SqlClient)
    Failed to convert parameter value from a String to a Boolean. (Microsoft.Data.SqlClient)
    Edit- I got it

    • @mehrdad_analyst
      @mehrdad_analyst  8 месяцев назад

      Did you use the correct version of SQL Server?

    • @navaneethcm8377
      @navaneethcm8377 8 месяцев назад

      @@mehrdad_analyst yeah, I think I didn't check allow null variables for a column the first time I guess

  • @radhikareddydasari491
    @radhikareddydasari491 7 месяцев назад

    Thank you for doing this analysis, Also can you please let me know how can i download this data, i tried to download github links provided above but i don't have find the data sets

    • @mehrdad_analyst
      @mehrdad_analyst  7 месяцев назад

      Hi. In this link there are two CSV files. you can download them and import in your SQL management application (MySQL or MS SQL). github.com/M3hrdad-Dehghan/SQL/tree/main/Exploratory_Data_Analysis_of_Vehicle_Accident_by_SQL

  • @siddartha1328
    @siddartha1328 Год назад

    Hey i have a small doubt the excel sheet contains dates in different formats and i am not sure how to change them into single format can you help me
    thanks in advance.

    • @mehrdad_analyst
      @mehrdad_analyst  Год назад

      Please send me an email and explain your problem

  • @araijeahmed6127
    @araijeahmed6127 7 месяцев назад +1

    hi ;
    in question 4 ; can we use this query
    SELECT
    AgeGroup,
    COUNT([AccidentIndex]) AS 'Total Accident',
    AVG([AgeVehicle]) AS 'Average Year',
    CASE
    WHEN [AgeVehicle] BETWEEN 0 AND 5 THEN 'New'
    WHEN [AgeVehicle] BETWEEN 6 AND 10 THEN 'Regular'
    ELSE 'Old'
    END AS AgeGroup
    GROUP BY
    AgeGroup;
    thanks

    • @mehrdad_analyst
      @mehrdad_analyst  7 месяцев назад

      Yes. You can use any query as long the query works and shows the same result. Just use your creativity 👍

    • @Yiling-lingmatriarch
      @Yiling-lingmatriarch 7 месяцев назад

      Used that one too, but include a group for nulls

  • @simonoganga9535
    @simonoganga9535 Год назад

    Hey bro., Is this the one you told me about you are working on? Let me check it out then I'll give you my feedback. But I already know it's amazing

    • @mehrdad_analyst
      @mehrdad_analyst  Год назад +2

      Hi Simon. It's just about the EDA project using T-SQL. You can find it a useful project for dealing with data to explore more about it. After running EDA on data, you are ready to use one of the BI tools to visualize data to gain more insights. By the way, I planned to run the E-2-E project, but I was tasked with a huge workload. So, I try to publish more videos on different topics.

  • @vasilli3273
    @vasilli3273 8 месяцев назад

    is it normal to have AccidentIndex with scientific values (Like 2.02E+10)?

    • @mehrdad_analyst
      @mehrdad_analyst  8 месяцев назад

      Accident Index is indeed a label in terms of data type. However, it is important to note that the values displayed in a column may not always correspond to the data type. For example, even though Accident Index is shown as a number, it is actually a label that is a combination of letters and numbers. Therefore, it is highly recommended to change the data type accordingly. It is worth mentioning that in the video, the accident index appears to be a scientific number, but it is actually a label.☺

    • @vasilli3273
      @vasilli3273 8 месяцев назад

      @@mehrdad_analyst
      in my case about 110.00 rows of AccidentIndex data converted to scidentific value in the procces of importing data to sql server database. which makes almost impossibble to analyse the data because we can't relate vehicleID's and AccidentIndex. I trided to change data types but doesn't work. couldn't figure out a solution.

  • @ikeibe452
    @ikeibe452 11 месяцев назад

    What generates such data in real life? I'm just asking to expand my knowledge

    • @mehrdad_analyst
      @mehrdad_analyst  11 месяцев назад +1

      This data is sourced from the UK Traffic Data Agency and represents genuine information for a particular timeframe.

  • @Naif-so8yk
    @Naif-so8yk 8 месяцев назад

    what is the purpose of accidentIndex in this query?

    • @mehrdad_analyst
      @mehrdad_analyst  8 месяцев назад

      we could use this variable as n unique (primary key) for accident identifier.

  • @hendraheryawan4393
    @hendraheryawan4393 8 месяцев назад

    do you have a data what u can practice too

  • @balajip.r.2144
    @balajip.r.2144 Месяц назад

    I want same data set

    • @mehrdad_analyst
      @mehrdad_analyst  Месяц назад

      You can download it by going to the link in the description of video.

  • @user-yi9xl5br7h
    @user-yi9xl5br7h 7 месяцев назад

    Data analyst always work with Excel data only can please clarify my doubt

    • @mehrdad_analyst
      @mehrdad_analyst  6 месяцев назад

      Excel is an application that is used for storing structured data. However, there are other tools available for storing structured data, such as databases, Access, and others. Apart from structured data, there are semi-structured data types, such as websites, and non-structured data types, such as voice, text, and video, that have their own storage systems. The most important step in data management is to understand the data itself, while tools and techniques are secondary.

  • @Rex-Solis
    @Rex-Solis Месяц назад

    Bruh there are null values in column Age Vehicle of vehicle table its not even getting imported in my mysql workbench csv is a headache fr !! Help me out someone

    • @mehrdad_analyst
      @mehrdad_analyst  Месяц назад

      I will export all data in an Excel file and I will upload it in my website. You can go there and download the dataset.

    • @Rex-Solis
      @Rex-Solis Месяц назад

      @@mehrdad_analyst That would help sir

  • @thummaluruharish1929
    @thummaluruharish1929 Год назад

    Can u share the dataset

  • @joasjonson9123
    @joasjonson9123 6 месяцев назад

    Do you have the source of the data?

    • @mehrdad_analyst
      @mehrdad_analyst  6 месяцев назад

      Unfortunately, it was on my local system and after changing system it was gone

  • @Behappy-ft5yc
    @Behappy-ft5yc 6 месяцев назад

    is this good for resume , please tell me guys

    • @mehrdad_analyst
      @mehrdad_analyst  6 месяцев назад

      yes sure. I tried to put most common syntax in this video

  • @abrahammoruti5967
    @abrahammoruti5967 6 месяцев назад

    I have a hard time understanding subquiry

    • @mehrdad_analyst
      @mehrdad_analyst  Месяц назад

      In SQL, a subquery is a query within another query. It's like a small query nested inside a larger on. This part selects "AccidentIndex" and "AgeVehicle" from the vehicle table. It also creates a new column called "AgeGroup" which categorizes vehicles into 'New', 'Regular', or 'Old' based on their age.In summary, the subquery first categorizes vehicles by age, and then the main query calculates statistics based on these categories.

  • @Ganeshay-996
    @Ganeshay-996 8 месяцев назад +4

    Why most youtuber are using Ms Ms SQL server....why not use oracle SQL tool

    • @mehrdad_analyst
      @mehrdad_analyst  8 месяцев назад +5

      Maybe just because it's easier to walk through. However, in real work condition, it doesn't matter which database management tool is being used

    • @Ganeshay-996
      @Ganeshay-996 8 месяцев назад

      @@mehrdad_analyst thanks for sharing guidance and knowledge

    • @mehrdad_analyst
      @mehrdad_analyst  8 месяцев назад +2

      @@Ganeshay-996 it's my pleasure

  • @ivanko-nebo
    @ivanko-nebo 6 месяцев назад

    I guess you didn't exactly answer the question 7.
    You just counted severity but wasn't you supposed to find out how many Fatal, Serious and Slight accidents were for example when people are Commuting to/from work?
    Maybe this query would answer it better:
    SELECT v.JourneyPurpose, a.Severity, COUNT(a.AccidentIndex) AS Accidents_Count
    FROM Car_Accidents..accident AS a
    JOIN Car_Accidents..vehicle AS v
    ON a.AccidentIndex = v.AccidentIndex
    GROUP BY v.JourneyPurpose, a.Severity
    ORDER BY 2 ASC, 3 DESC