%% Outer-Join Operation of Tables with One Variable in Common
% Create a table, Tleft.

Tleft = table([5;12;23;2;15;6],...
        {'cheerios';'pizza';'salmon';'oreos';'lobster';'pizza'},...
        'VariableNames',{'Age','FavoriteFood'},...
        'RowNames',{'Amy','Bobby','Holly','Harry','Marty','Sally'})

%
% Create a table, Tright, with one variable in common with Tleft, called FavoriteFood.

Tright = table({'cheerios';'oreos';'pizza';'salmon';'cake'},...
         [110;160;140;367;243],...
         {'A-';'D';'B';'B';'C-'},...
         'VariableNames',{'FavoriteFood','Calories','NutritionGrade'})

%
% Use the outerjoin function to create a new table, T, with data from tables Tleft and Tright.

T = outerjoin(Tleft,Tright)

% Table T contains a separate variable for the key variable from Tleft, called FavoriteFood_Tleft, and the key variable from Tright, called FavoriteFood_Tright.
% Copyright 2012 The MathWorks, Inc.