PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, December 15, 2022

[FIXED] What do you call the <database>.<table> syntax in SQL?

 December 15, 2022     database, select, sql, syntax, terminology     No comments   

Issue

In many databases, when writing a SELECT query, you can provide the database name along with the table name in order to resolve any ambiguity the database might encounter in case there are multiple databases with the same table names.

For example, let's say the user currently logged into SQL Server has SELECT privileges on databases DB1 and DB2, and BOTH databases have a table named CUSTOMERS. The following query would return an error stating that the table name is too ambiguous:

SELECT * FROM CUSTOMERS

The solution is to be more specific so the database knows which table to query from:

SELCT * FROM DB1.CUSTOMERS

My question is, what is the name for the <database>.<table> syntax in SQL? I'm asking so that my terminology is correct when explaining it to junior devs.


Solution

These are typically called "qualified" and names, and they can be used when an "unqualified" name is ambiguous, for example when a select query pulls data from multiple tables that share column names.



Answered By - user229044
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing