Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 34,558 Points

Join two tables with no common attributes

I am taking an advanced database class. The instructor keeps using the term "writtenby" table to refer to querying tables that share no common columns/attributes.

Does anyone out there know what kind of join or query produces a "writtenby" table?

Thanks in advance.

Dan Garrison
Dan Garrison
22,457 Points

I haven't ever heard of this and I couldn't find anything on Google either. It might be worth asking your instructor to clarify this. Do you know what database you are working with? Is it a relational SQL database or NoSQL like MongoDB?

At the moment, I don't know much about NoSQL databases, but in relational SQL databases you should be able to get to tables that aren't linked by a primary or foreign key by joining to other tables until you can access the information. That's usually what I do when the tables aren't directly linked.

2 Answers

Steven Parker
Steven Parker
225,712 Points

I've never heard of the term "writtenby". Perhaps it was the name of a specific table in an example?

You might ask your instructor for an example if you don't have one already. Offhand, I'm not sure what the value of joining tables would be if they don't have any common column(s).

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 34,558 Points

RIght. I feel dumb. It was a specific table called "writtenby" and I finally found it by using the query to get the entire database structure.

I am sorry. Thanks for taking the time.