HomeОбразованиеRelated VideosMore From: golearnfast

13 MySQL Tutorial for Beginners: Table Aliases, Self Joins

34 ratings | 5483 views
When you name a table to be joined in the FROM clause, you can refer to that table by an alias. A table alias is just an alternative table name and you code it just near the table’s name. After you assign a table alias, you must use the alias in place of the original table name everywhere in the query. It’s recommended to use abbreviations of the table names which consist of just one letter or two. After you assign a table alias, you must use the alias in place of the original table name everywhere in the query. In other words you can't use the original table name anymore. Otherwise, MySQL returns an error message. Although a join condition typically consists of a single comparison, you can include two or more comparisons in a join condition using the AND and OR operators. You can also join more than two tables. You can think of a multi-table join as a series of two-table joins proceeding from left to right. If you need a WHERE clause and an ORDER BY clause, you code them to the end of the statement. Note that the conditions specified in the WHERE clause is applied after the condition specified in the ON phrase. A self-join is a common join that joins a table to itself. Since in a self-join you use the same table twice, you must use aliases to distinguish one occurrence of the table from the other . In addition, the query must qualify each column name with a table alias since every column occurs in both tables. EXERCISES for your SELF-TRAINING: http://golearnfast.com/Quizzes.php?_SelectSmallerGroup_290=0&Lessons_ID=290 SCRIPT FOR THE EXAMPLES: http://www.golearnfast.com/files/lessons_material/lesson_277_1440544998.sql SUBSCRIBE! https://www.youtube.com/channel/UCMEaGDoHU7c9tWyafZ9vC6Q?sub_confirmation=1 FACEBOOK https://www.facebook.com/golearnfast GOOGLE+ https://plus.google.com/u/0/b/101326338689489366802/
Html code for embedding videos on your blog
Text Comments (1)
Stewhat (2 years ago)
Thanks for the helpful video!

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.