ICP 5 - a190884810/Big-Data-Programming GitHub Wiki
- Create table in MySQL and Import into HDFS through Sqoop
- Export table from HDFS to MySQL
- Start the MySQL service with the below command:
- sudo service mysqldstart
- And enter MySQL shell using the below command:
- mysql-u root -pcloudera
Step:2
- Command to list database
- if already existing:
- show databases;
- Command to create a new database:
- create database db1;
- Command for using the database:
- use db1;
- Step:3
- Also creating table, inserting values inside table is done using the following syntax.
- create table (column name1, column name 2);
- insert into
-
For export
-
Table and Schema
-
Creation through HQL Scripthive
-
–f tables-schema.hqlNote:
-
1.Download the data (data/employees from SourceCodeLink)
-
2.Change the location of data in file based on your data.
-
3.Comment lines (--) with DB in HQL File (3 lines)
-
The Data from Hive Table has been transferred to the MySQL Table
-
Choose one of following datasets
-
Employees
-
query1.
-
select name,SUM(salary) FROM employees GROUP BY name;
-
query2.
-
select name,salary From employees order by salary desc limit 10;
-
query3.
-
select name,SUM(salary) From employees where name="Todd Jones" GROUP BY name;
-
query4.
-
SELECT name, count(1) AS count FROM employees GROUP BY name ORDER BY name;
Four queries: