Creating, copying, and dropping tables
Teradata Database uses tables to store data in rows. Tables consist of rows and columns in a database, and can be seen in the following figure:
In Teradata, you can create the following types of tables:
- Permanent Table: Remains in the database until dropped manually:
SET
MULTISET
- Temporary Table: Session based:
- Derive table
- Volatile table
- Global temporary table
- Queue table
- Error logging table
- NOPI table
In this recipe, we will create, drop, and copy data from one table to another.
Getting ready
You need to connect to Teradata Database using SQLA or Studio.
How to do it...
- Connect to Teradata Database using SQLA or Studio.
- Create the following permanent table in Database using the following code; it can be seen in the screenshot of SQLA:
/*Create set table*/ CREATE volatile TABLE td_cookbook.EMP_TBL (EMP_ID INTEGER , EMP_Name VARCHAR(20), Sal INTEGER)primary index (EMP_ID)
- Let's insert data into the table by using the following code. Also, check the snippet from SQLA...