Book Image

Teradata Cookbook

By : Abhinav Khandelwal, Viswanath Kasi, Rajsekhar Bhamidipati
Book Image

Teradata Cookbook

By: Abhinav Khandelwal, Viswanath Kasi, Rajsekhar Bhamidipati

Overview of this book

Teradata is an enterprise software company that develops and sells its eponymous relational database management system (RDBMS), which is considered to be a leading data warehousing solutions and provides data management solutions for analytics. This book will help you get all the practical information you need for the creation and implementation of your data warehousing solution using Teradata. The book begins with recipes on quickly setting up a development environment so you can work with different types of data structuring and manipulation function. You will tackle all problems related to efficient querying, stored procedure searching, and navigation techniques. Additionally, you’ll master various administrative tasks such as user and security management, workload management, high availability, performance tuning, and monitoring. This book is designed to take you through the best practices of performing the real daily tasks of a Teradata DBA, and will help you tackle any problem you might encounter in the process.
Table of Contents (19 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Importing data


Let's get the ball rolling now.

We have had Teradata Studio Express and SQLA up and running for a while now. It is time to load data into the Teradata Database.

Now, there are many ways to do this, but, for simplicity, I will be importing data via Excel using the GUI option in Teradata Studio Express. You can copy the table data from Teradata to a data lab just by dragging the source table from the data lab view. The datalab copy wizard helps you through step by step.

Note

A data lab is a separate dedicated work space, also known as a sandbox, sandpit or a test area.

You can get the dataset from various websites; there are tons of websites giving free datasets for analysis.

Getting started

The following are the prerequisites to import the data:

  1. Create a new user, for example, Mike.
  2. Create a new database, for example, TestDb.
  3. Allocate space to the new database.
  4. Grant appropriate access rights to the new database for the new user.

 

  1. Create a table DDL under this database with the same column layout as the import file:

How to do it...

Let's begin with importing data using Studio first and then we will move on to SQLA. The following DDL was used to create the table in the new database. Now load the data from the external file. The following steps allow you to do so:

  1. Go to data explorer. 
  2. Search for the database under which the required table is located:
  1. Explore the database.

 

  1. Right-click on the table, Name | Data | Load Data:
  1. The Wizard will come up; select the source as External File:

  1. On the next screen, just browse to the CSV file you need to load the data from.
  2. Once the data is loaded, you will get a success message. 
  3. To verify the data, right-click on the table, Name | Data | Sample Data; a few rows will pop up, showing that the data has been loaded.

In Express

This one is also as easy as Studio Express. The prerequisites are the same as Studio: 

  1. Select the Import data option from the File tab.
  2. You need to write SQL to start importing the data.
ins into AP.countries (?,?)
  1. ? here defines the number of columns in your file.
  2. Turn off the import function and execute Sel * from the table name to verify the data:

Note

Use different formats to import files from Tools | Options |Export/Import.

To use the CSV file, select Options, as shown in the following screenshot:

Data transfer is a two-way street. We sometimes also have requirements to export the data to a file.

Teradata Studio Express and SQL Assistant both can be used to export data as well.