sqoop - Sqoop Where Clause - apache sqoop - sqoop tutorial - sqoop hadoop
What is Where clause in Sqoop?
- The WHERE clause is used to filter records.
- The WHERE clause is used to extract only those records that fulfill a specified condition.
- You can place limitations on data imported by using "where" clause.
Example
- Let's import cityByCountry table where state (6th column is restricted to "Alaska").

Learn Sqoop - Sqoop tutorial - Where Sqoop - Sqoop examples - Sqoop programs
sqoop import \ --connect "jdbc:mysql://localhost/training" \ --username training -P \ --table cityByCountry \ --target-dir /user/where_clause \ --where "state = 'Alaska'" \ -m 1
Click "Copy code" button to copy into clipboard - By wikitechy - sqoop tutorial - team
Output

Learn Sqoop - Sqoop tutorial - Where Clause Sqoop - Sqoop examples - Sqoop programs
Note: For more information on list-databases, type "$ sqoop help list-databases"
$ sqoop list-databases --connect "jdbc:mysql://localhost" --username cloudera --password cloudera