Disambiguation is one of the key aspects of every good database structure. If we don't structure our data properly, we might stumble on some problems while querying a database. Consider the following two tables (MySQL):
CREATE TABLE documents ( id INT(11) NOT NULL AUTO_INCREMENT, title VARCHAR(64), content TEXT); CREATE TABLE posts ( id INT(11) NOT NULL AUTO_INCREMENT, title VARCHAR(64), posts_content TEXT);
I've omitted table options and table type for the sake of brevity. If we try to run a query which selects, say, both title
from the two tables, we'll see an SQL error, because this is an ambiguous query. The solution is pretty simple: always use prefixes to avoid ambiguity. This is also a good SQL coding practice.