Time for action – setting up the employee database
No discussion of databases is complete without the example of an employee table, so we will follow tradition and start there.
- Create a tab-separated file named
employees.tsv
with the following entries:Alice Engineering 50000 2009-03-12 BobSales 35000 2011-10-01 Camille Marketing 40000 2003-04-20 David Executive 75000 2001-03-20 Erica Support 34000 2011-07-07
- Connect to the MySQL server:
$ mysql -u hadoopuser -p hadooptest
- Create the table:
Mysql> create table employees( first_name varchar(10) primary key, dept varchar(15), salary int, start_date date ) ;
- Load the data from the file into the database:
mysql> load data local infile '/home/garry/employees.tsv' -> into table employees -> fields terminated ...
Get Hadoop: Data Processing and Modelling now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.