Hello there its me again,
So by now, you know what this is all about. But let me clarify once again that we are now going to discuss SQL aliasing for better readability and cleaner queries. It's helpful to use aliases if the names of your tables or columns are too long. We can use aliases for column names, tables, subqueries, and so on, but we'll focus on table and column names since this is more basic and easier to understand. and it also good to use alias if you are going to combining column.
Here's the example of query that no alias.
As you can see, there is a '?' column. This signifies that we combined the tables, but the SQL engine couldn't determine a name for it, hence the default '?column?' in the SQL column.
This one is the revise version
We add an alias to the combined column name so that it can be given a column name. This is just one example of how aliases are used. We use aliases in table names, subqueries, etc., as I mentioned earlier. However, we're not discussing those uses now because we're focusing on the basics. We may explore those topics later, but it's important to grasp the fundamentals first.
Now that you know what is alias is try to apply it in your query and see the improvement. I hope you learn from this blog , Thank you so much again and good day.
- The data that I'm using here is just dummy data sourced from DataCamp, so there's no need to worry, guys. MARKME
Top comments (0)