GerardoH95 Posted March 2, 2020 Share Posted March 2, 2020 Im currently following the SQL tutorial on w3schools and i got stuck in the Alias section about the usage of the "dot" in a query, after looking it on google i found that its something like a parent-child relation so that the DBMS know where to fetch the values from. However i feel that this example in the tutorial is too verbose: SELECT Orders.OrderID, Orders.OrderDate, Customers.CustomerNameFROM Customers, OrdersWHERE Customers.CustomerName="Around the Horn" AND Customers.CustomerID=Orders.CustomerID; And can be easily translated to this other one SELECT OrderID, OrderDate, CustomerName FROM Customers, Orders WHERE CustomerName="Around the Horn" AND Customers.CustomerID=Orders.CustomerID; it retrieves the same data in the practice tool, so i want to know if im doing a good practice by removing this redundancy or not. here is the link to the topic im talking about: https://www.w3schools.com/sql/sql_alias.asp Link to comment Share on other sites More sharing options...
Funce Posted March 5, 2020 Share Posted March 5, 2020 I believe it's been deliberately verbose to illustrate it. You won't find this level of explicit alias usage elsewhere in other tutorials. Link to comment Share on other sites More sharing options...
Ingolme Posted March 5, 2020 Share Posted March 5, 2020 If you had two different tables with the same field names, the dot would be necessary for the query to run. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now