knowt logo

Learn Basic SQL in 15 Minutes - Business Intelligence For Beginners - SQL Tutorial For Beginners Part 1/3

Chapter 1: Introduction

  • Basics of SQL querying in 15 minutes

  • Introduction to vitamin BI, business intelligence for beginners

  • SQL querying essential for becoming a business intelligence analyst

  • Focus on querying data, not creating or deleting databases

  • BI tools can write SQL queries for requesting data for charts, graphs, and tables

  • Views are created to pre-aggregate and filter data for efficiency

  • Knowing SQL querying is a useful skill

  • Working with a SQLite database containing FIFA video game data

  • Using Navicat as the tool to query the database

  • Connected to the soccer DB connection with a database called main

  • Working mainly with the player table

Chapter 2: Querying Data

  • Using SQL queries to ask the database for specific data from the player table

Chapter 2: Called Player

  • We use a select statement to ask for data from a table called player

    • Example: SELECT * FROM player

    • The database returns all data from the table

  • Beautifying the SQL query

    • Capitalizing select and from makes queries easier to read

    • Not obligatory, but helpful for larger queries

  • Selecting specific fields

    • Instead of *, write out the field names separated by commas

    • Example: SELECT player_name, birthday

  • Creating aliases for selected fields

    • Use the AS function

    • Example: player_name AS name

    • Aliases can contain spaces if put in quotes

    • Example: "full name"

  • Using a where clause to select specific rows

    • Use different operators

    • Example: weight = 190

    • Example: weight > 190

    • Example: weight >= 190

  • Specifying multiple conditions with AND or OR

    • AND: Both conditions must be met

    • OR: Either condition must be met

    • Example: weight > 190 AND height > 190

    • Example: weight > 190 OR height > 190

  • Selecting rows based on text values

    • Use the equals operator with single quotes

    • Example: player_name = 'Aaron Galindo'

Chapter 3: Find Any Player

  • Using the like operator to select rows with specific player names

    • Using a percent character after the text to look for names starting with "Aaron"

    • Using a percent character before the text to look for names ending with "Aaron"

    • Using a percent character before and after the text to look for names containing "Aaron"

    • Using the percent character in the middle of the text to look for names starting with "a" and ending with "n"

  • Using the underscore as a wildcard to represent a single character

    • Example: "t_mpercent" matches names starting with "t", followed by any character between "t" and "m", and ending with "rum"

  • Using the "in" operator for exact matches in text fields

    • Example: "in (Cristiano Ronaldo, Lionel Messi)" matches rows with player names "Cristiano Ronaldo" or "Lionel Messi"

  • Using the "between" operator for integer values

    • Example: "where weight between 180 and 190" matches rows with weights between 180 and 190

  • Using the "is null" and "is not null" operators to check for empty values

    • Example: "where home player 1 is null" matches rows where the "home player 1" field is empty

  • Sorting results using the "order by" clause

    • By default, rows are sorted by the ID field in ascending order

    • Example: "order by weight" sorts rows by weight in ascending order

    • Adding "DESC" after the field name sorts the rows in descending order

Chapter 4: Use The Player

  • Sorting data using orderby is not important for our use case

  • Views are usually connected to a BI tool for building individual chart queries

  • Joining data from different tables is necessary to create a view with player name and overall rating

  • Specify table name dot field name to indicate which field comes from which table

  • Specify the joining of tables using one of the four join types

  • Use inner join and specify the fields to create the join

  • Use the as function to create aliases for tables and fields

  • Aggregate data using the sum aggregator to add up values for each player

Chapter 5: Use The Group

  • Grouping data together using the GROUP BY clause

    • Specify all fields to group, except overall rating

  • Combining ratings for different dates

    • Remove "AND run" from the query

  • Aliasing the overall rating as "rating"

    • Sort the result in descending order by rating

  • Exploring why Ronaldo and Messi are not at the top

    • Adding a count of player name to see if there are more entries for some players

    • Replacing "SUM" with "AVG" to calculate the average rating

  • Filtering the result using the HAVING clause

    • Applying the HAVING clause after the GROUP BY clause and before the ORDER BY clause

    • Filtering for ratings above 85

  • Finalizing the query

    • Beautifying the query

Conclusion

  • Capitalization of SQL keywords

  • Covered a small part of SQL, more to learn

  • Provided a good foundation for diving deeper into SQL

Chapter 6: Conclusion

  • If you got value out of this video, please do like, share, and subscribe for more videos like this one.

  • Why not start with this playlist here?

  • As always, thanks for watching.

  • I've been Adam Feiner.

  • Until the next time, stay behind curious.

Chapter 1: Introduction

  • Basics of SQL querying in 15 minutes

  • Introduction to vitamin BI, business intelligence for beginners

  • SQL querying essential for becoming a business intelligence analyst

  • Focus on querying data, not creating or deleting databases

  • BI tools can write SQL queries for requesting data for charts, graphs, and tables

  • Views are created to pre-aggregate and filter data for efficiency

  • Knowing SQL querying is a useful skill

  • Working with a SQLite database containing FIFA video game data

  • Using Navicat as the tool to query the database

  • Connected to the soccer DB connection with a database called main

  • Working mainly with the player table

Chapter 2: Querying Data

  • Using SQL queries to ask the database for specific data from the player table

Chapter 2: Called Player

  • We use a select statement to ask for data from a table called player

    • Example: SELECT * FROM player

    • The database returns all data from the table

  • Beautifying the SQL query

    • Capitalizing select and from makes queries easier to read

    • Not obligatory, but helpful for larger queries

  • Selecting specific fields

    • Instead of *, write out the field names separated by commas

    • Example: SELECT player_name, birthday

  • Creating aliases for selected fields

    • Use the AS function

    • Example: player_name AS name

    • Aliases can contain spaces if put in quotes

    • Example: "full name"

  • Using a where clause to select specific rows

    • Use different operators

    • Example: weight = 190

    • Example: weight > 190

    • Example: weight >= 190

  • Specifying multiple conditions with AND or OR

    • AND: Both conditions must be met

    • OR: Either condition must be met

    • Example: weight > 190 AND height > 190

    • Example: weight > 190 OR height > 190

  • Selecting rows based on text values

    • Use the equals operator with single quotes

    • Example: player_name = 'Aaron Galindo'

Chapter 3: Find Any Player

  • Using the like operator to select rows with specific player names

    • Using a percent character after the text to look for names starting with "Aaron"

    • Using a percent character before the text to look for names ending with "Aaron"

    • Using a percent character before and after the text to look for names containing "Aaron"

    • Using the percent character in the middle of the text to look for names starting with "a" and ending with "n"

  • Using the underscore as a wildcard to represent a single character

    • Example: "t_mpercent" matches names starting with "t", followed by any character between "t" and "m", and ending with "rum"

  • Using the "in" operator for exact matches in text fields

    • Example: "in (Cristiano Ronaldo, Lionel Messi)" matches rows with player names "Cristiano Ronaldo" or "Lionel Messi"

  • Using the "between" operator for integer values

    • Example: "where weight between 180 and 190" matches rows with weights between 180 and 190

  • Using the "is null" and "is not null" operators to check for empty values

    • Example: "where home player 1 is null" matches rows where the "home player 1" field is empty

  • Sorting results using the "order by" clause

    • By default, rows are sorted by the ID field in ascending order

    • Example: "order by weight" sorts rows by weight in ascending order

    • Adding "DESC" after the field name sorts the rows in descending order

Chapter 4: Use The Player

  • Sorting data using orderby is not important for our use case

  • Views are usually connected to a BI tool for building individual chart queries

  • Joining data from different tables is necessary to create a view with player name and overall rating

  • Specify table name dot field name to indicate which field comes from which table

  • Specify the joining of tables using one of the four join types

  • Use inner join and specify the fields to create the join

  • Use the as function to create aliases for tables and fields

  • Aggregate data using the sum aggregator to add up values for each player

Chapter 5: Use The Group

  • Grouping data together using the GROUP BY clause

    • Specify all fields to group, except overall rating

  • Combining ratings for different dates

    • Remove "AND run" from the query

  • Aliasing the overall rating as "rating"

    • Sort the result in descending order by rating

  • Exploring why Ronaldo and Messi are not at the top

    • Adding a count of player name to see if there are more entries for some players

    • Replacing "SUM" with "AVG" to calculate the average rating

  • Filtering the result using the HAVING clause

    • Applying the HAVING clause after the GROUP BY clause and before the ORDER BY clause

    • Filtering for ratings above 85

  • Finalizing the query

    • Beautifying the query

Conclusion

  • Capitalization of SQL keywords

  • Covered a small part of SQL, more to learn

  • Provided a good foundation for diving deeper into SQL

Chapter 6: Conclusion

  • If you got value out of this video, please do like, share, and subscribe for more videos like this one.

  • Why not start with this playlist here?

  • As always, thanks for watching.

  • I've been Adam Feiner.

  • Until the next time, stay behind curious.