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! While you're at it, check out some resources Treehouse students have shared here.

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

Development Tools Database Foundations Joining Relational Data Between Tables in SQL Joining Tables and Aliasing

Joe Ainsworth
Joe Ainsworth
13,588 Points

Schema design to avoid using AS syntax

Is it good practice to prepend column names with the table name.

e.g. for a movies table with a column storing the title of the movie

movies_name

and for a genres table with a column storing the genre of the movie

genres_name

my idea behind this would be to avoid having to use the AS syntax?

Just noticed this when watching the joining relational data between tables in sql video.

The benefits of the AS syntax is that it allows you to make the column id's more 'user friendly'.

Does 'movie_name' or 'movie name' look better?

You don't HAVE to use AS at all if you don't want to. In general, you'll build some kind of user interface on top of your database (be it a web app or just a plain old app) that will label columns and rows in ways to make them more user friendly.

Also - (I haven't watched the video yet) As comes in VERY handy when you do 'math' or other work on a column, be it adding, summing, averaging, and the like...any sort of 'methodology' you perform on a column carries over to label the column that way if you don't use AS