What does fully qualified name means in SQL? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 4

What does fully qualified name means in SQL?

I cannot understand what is fully qualified names and why we should use that in our database! I also have to mention that I'm a beginner in SQL and my question is not in a professional manner, just I cannot understand what does this query(for example "customers.ciry" instead of "city") means and what is differences between these two?! thank whom answer my question! 🌹

6th Jul 2018, 9:49 PM
Alireza Askarikheirabadi
Alireza Askarikheirabadi - avatar
5 ответов
+ 6
Fully qualified names are used to avoid the collisons of the names. we can have column with the same name in two differnt table or we can have two tables with the same name in two different databases... So, to avoid the collision and help the sql server to find out the right table and columns, we use fully qualified names. It is always a good practice to do so because you never know that when you come up with the new table having the same column name as already being used in other table and similarly in the case of database. Fully qualified names goes in the order... dbname.tableName.columnName you can ignore dbname if you have already selected your database before running the query.
6th Jul 2018, 11:50 PM
Jain Rishav Amit
Jain Rishav Amit - avatar
+ 8
I'm assuming you are referring to coding style. It is always good to use fully qualified names and make it a habit. This is because when you are joining more than two tables, they often have the same column name as key (which is logical), but can also have similar or same column names with different meaning for other data features. Maintaining the coding style as always referring to a table prevents your query from unexpected results. And it is also easier to understand for someone who is picking up your code to further expand it for different use.
6th Jul 2018, 10:27 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Database_name .dbo.table _name this is fully qualified name
7th Jul 2018, 3:08 AM
What happens if 2 tables Customers and Employees have a column each called Name and we used a query with Name without specifying which table it is from (without using the fully qualified name)? Will an error occur or will the Name column be randomly chosen from either table?
9th Mar 2020, 6:16 PM
27th Aug 2021, 11:00 PM
Mahdi Tahir Ahmat
Mahdi Tahir Ahmat - avatar