Jump to content

Question related to the "dot"usage in SQL


Recommended Posts

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.CustomerName
FROM Customers, Orders
WHERE 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 post
Share on other sites

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 post
Share on other sites

If you had two different tables with the same field names, the dot would be necessary for the query to run.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...