title: SQL Queries from multiple tables
body: <p>I am taking a beginner's course in SQL, and have been playing around with some queries. One thing I don't really understand is how to "properly" query multiple tables, that is; compare values from two or more tables. </p>
  
  <p>For instance, 
  I have a table called <strong>Student</strong>, holding the username, name, date of birth, and major (just the code. For instance, CS would stand for "Computer Science") of a particular person. I chose to make the username a primary key. </p>
  
  <p>I also have another table called <strong>Major</strong> holding the major code (such as CS) as a primary key, and the entire major name. For instance, "CS" = "Computer Science", NS = "Neuroscience", etc. </p>
  
  <p>Now, suppose I want to find the name of a major, given a student's username. Following is the imagined pseudocode for this query: </p>
  
  <p>1) In the <strong>Student</strong> table: Provided the username, check what the major of that particular person is. </p>
  
  <pre><code>select majorcode from Student where username='aUserName';
  </code></pre>
  
  <p>Doing so correctly gives me the major code. </p>
  
  <p>2) In the <strong>Major</strong> table: Find the title of the major provided the code. </p>
  
  <pre><code>select majorTitle from Major where majorcode='theMajorCode';
  </code></pre>
  
  <p>Combinded, I write: </p>
  
  <pre><code>select majorTitle from Major where majorcode=(select majorcode from Student where username='aUserName');
  </code></pre>
  
  <p>However, now suppose I want <strong>BOTH</strong> the <strong>title of the major</strong> (from the Major table) as well as the <strong>name of the student</strong> (from the Student table). </p>
  
  <p>Any advice on how to do this? </p>