title: how to print data from second table in MySQL
body: <p>I have main table called <strong>companyNames</strong>, and each row contains the <strong>name of the company,</strong> for eg. TCS, TATAMOTORS, INFY, etc. and also having their tables, like table TCS, table INFY etc, so i'm trying to <strong>print all information</strong> from these table. but it is not printing..</p>
  
  <pre><code> +------------+
  | names      |
  +------------+
  | TCS        |
  | INFY       |
  | TATAMOTORS |
  | TATASTEEL  |
  +------------+
  Company Name
  
  +------------+---------+---------+---------+--------+---------+-----------+
  | date       | high    | low     | open    | close  | volume  | adj_close |
  +------------+---------+---------+---------+--------+---------+-----------+
  | 2015-06-15 | 1260.22 |  1240.5 | 1252.65 | 1252.4 | 2525176 |   1098.59 |
  | 2015-06-16 | 1259.65 | 1247.22 |    1250 |   1256 | 1267396 |   1101.74 |
  | 2015-06-17 | 1264.57 |  1250.9 |  1260.5 | 1256.9 | 1975720 |   1102.53 |
  +------------+---------+---------+---------+--------+---------+-----------+  
                                 TCS
  
  +------------+---------+---------+--------+--------+---------+-----------+
  | date       | high    | low     | open   | close  | volume  | adj_close |
  +------------+---------+---------+--------+--------+---------+-----------+
  | 2018-07-15 |  720.22 |   120.5 |   1255 | 1252.4 | 2525176 |   1098.59 |
  | 2017-03-11 | 1259.65 | 1247.22 |   12.5 |   1256 |    1267 |   1101.74 |
  | 2014-01-14 | 1264.57 |  1250.9 | 1260.5 | 1256.9 | 1975720 |   1102.53 |
  +------------+---------+---------+--------+--------+---------+-----------+ 
                                   INFY
  </code></pre>
  
  <p>after </p>
  
  <pre><code>select * from (select names from companyNames) as a;
  </code></pre>
  
  <p>above query is just printing the names of the companies not the information stored in TCS, INFY and other tables.</p>
  
  <pre><code>+------------+
  | names      |
  +------------+
  | TCS        |
  | INFY       |
  | TATAMOTORS |
  | TATASTEEL  |
  +------------+
  </code></pre>
  
  <p>please help me to print all companies information, also give me suggestions to make the database more effiecient.</p>