Database Reference
In-Depth Information
SQL
queries
against
the
example
database
Now, let's list all the items from both the automobiles and motorcycles table. Be-
cause we have a long list of items, to save page space we will limit the output to only
the top five items, as follows:
[Hadoop.testdomain:21000] > select * from
automobiles limit 5;
Query finished, fetching results ...
+-----------+------------+----------+----------+------------+--------+----------+-----------+------------+--------------+--------+
| make | model | autoyear | fueltype |
numofdoors | design | autotype | cylinders |
horsepower | city_hwy_mpg | price |
+-----------+------------+----------+----------+------------+--------+----------+-----------+------------+--------------+--------+
| Audi | A4 | 2011 | gas |
4 | sedan | casual | 6 |
476 | 22-30 | 45000 |
| Jeep | Compass | 2007 | gas |
3 | suv | sport | 6 |
170 | 24-32 | 22000 |
| Dodge | Challenger | 2013 | gas |
4 | coupe | casual | 6 |
210 | 20-30 | 28000 |
| Chevrolet | Volt | 2014 | electric |
4 | sedan | casual | 0 |
180 | 35-40 | 35000 |
| Toyota | Prius | 2013 | hybrid |
4 | sedan | casual | 4 |
134 | 51-48 | 32000 |
+-----------+------------+----------+----------+------------+--------+----------+-----------+------------+--------------+--------+
Returned 5 row(s) in 1.77s
In the next step, we will use the same select statement with a variation to list only
those motorcycles that have autoyear above 2010, as shown in the following code
snippet:
Search WWH ::




Custom Search