Hey Guys, Hope you’re good.
I’m sorry I’ve been away for a while. I’m trying to juggle multiple things at once and cant get enough time. Anyways, let’s get started.
Today, we’ll be looking at views in SQL.
What Are Views?
Views are virtual tables based on a select query from base tables. It does not store the data but basically presents data from the tables in the SELECT statement. They retrieve live data whenever queried.
Let’s take our video games dataset. I want to create a view that only shows the games by Rockstar. So, let’s get started.
You can see that all the games are from Rockstar Games.
Benefits Of Views In MySQL
Here are some benefits of using Views in SQL:
Security & Access Control
You can restrict access to specific columns or rows instead of exposing the entire table.
Simplifies Complex Queries
Instead of writing long and complex queries, you can save them as a view and reuse them.
Data Abstraction
Users can interact with a simplified structure without worrying about the underlying table schema.
Consistency
Ensures a uniform way of representing data without changing the actual table.
Exercise
Here’s what you need to do today:
Load the train station dataset
Create a view of transaction and the departure station where you select any train station as your condition
Did you get the desired output? Tell me in the comments
I am a BI Engineer working at a Data And AI Firm. I’m trying to help newbies in Data land their first data job and impact as many fellow data professionals as I can. Here’s my contact info:
ajmal7809@gmail.com
bideveloper_ (Discord)