title: In MySql, how do I insert data into a table that references three other tables, and then select that data?
body: <p>I have one <code>appointment</code> table that references three other tables: <code>counselor</code>, <code>client</code>, and <code>room</code>. I need to insert data from those three tables into the <code>appointment</code> table. I created the <code>appointment</code> table as follows: </p>
  
  <pre><code>create table appointment(
      AppointmentID int default next value for NDFCID primary key,
      CounselorID int not null references counselor,
      ClientID int not null references client,
      RoomNumber int not null references room,
      AppointmentDate date,
      StartTime time(0),
      Duration varchar(50)
  );
  </code></pre>
  
  <p>After I inserted the data into the other three tables, I want to insert data into appointment and this is what I have so far:</p>
  
  <pre><code>insert into appointment(counselor.firstName, client.firstName, room.RoomName, AppointmentDate,StartTime,Duration)
    values
    ('Audrey', 'Sarah', 'Clear sky', '10/1/2014', '8:00:00', '90');
  </code></pre>
  
  <p>Is there any way to do this that I won't have to hard code the string names into the insert, and just reference them from the tables? There are many values that I want to insert into <code>appointment</code>. And once I've inserted, how will I select the data to display? Should I be selecting and join all within the insert statement, or will that come after? </p>