- Teradata Tutorial
- Teradata - Home
- Teradata Basics
- Teradata - Introduction
- Teradata - Installation
- Teradata - Architecture
- Teradata - Relational Concepts
- Teradata - Data Types
- Teradata - Tables
- Teradata - Data Manipulation
- Teradata - SELECT Statement
- Logical & Conditional Operators
- Teradata - SET Operators
- Teradata - String Manipulation
- Teradata - Date/Time Functions
- Teradata - Built-in Functions
- Teradata - Aggregate Functions
- Teradata - CASE & COALESCE
- Teradata - Primary Index
- Teradata - Joins
- Teradata - SubQueries
- Teradata Advanced
- Teradata - Table Types
- Teradata - Space Concepts
- Teradata - Secondary Index
- Teradata - Statistics
- Teradata - Compression
- Teradata - Explain
- Teradata - Hashing Algorithm
- Teradata - Join Index
- Teradata - Views
- Teradata - Macros
- Teradata - Stored Procedure
- Teradata - JOIN Strategies
- Teradata - Partitioned Primary Index
- Teradata - OLAP Functions
- Teradata - Data Protection
- Teradata - User Management
- Teradata - Performance Tuning
- Teradata - FastLoad
- Teradata - MultiLoad
- Teradata - FastExport
- Teradata - BTEQ
- Teradata Useful Resources
- Teradata - Questions & Answers
- Teradata - Quick Guide
- Teradata - Useful Resources
- Teradata - Discussion
Teradata - Create Tables
CREATE TABLE command is used to create tables in Teradata.
Syntax
Following is the generic syntax of CREATE TABLE statement.
CREATE <SET/MULTISET> TABLE <Tablename> <Table Options> <Column Definitions> <Index Definitions>;
Table Options − Specifies the physical attributes of the table such as Journal and Fallback.
Column Definition − Specifies the list of columns, data types and their attributes.
Index Definition − Additional indexing options such as Primary Index, Secondary Index and Partitioned Primary Index.
Example
The following example creates a table called employee with FALLBACK option. The table contains 5 columns with EmployeeNo as the Unique Primary Index.
CREATE SET TABLE EMPLOYEE,FALLBACK ( EmployeeNo INTEGER, FirstName VARCHAR(30), LastName VARCHAR(30), DOB DATE FORMAT 'YYYY-MM-DD', JoinedDate DATE FORMAT 'YYYY-MM-DD', DepartmentNo BYTEINT ) UNIQUE PRIMARY INDEX ( EmployeeNo );
Once the table is created, you can use SHOW TABLE command to view the Definition of the table.
SHOW TABLE Employee; *** Text of DDL statement returned. *** Total elapsed time was 1 second. ------------------------------------------------------------------------ CREATE SET TABLE EMPLOYEE ,FALLBACK , NO BEFORE JOURNAL, NO AFTER JOURNAL, CHECKSUM = DEFAULT, DEFAULT MERGEBLOCKRATIO ( EmployeeNo INTEGER, FirstName VARCHAR(30) CHARACTER SET LATIN NOT CASESPECIFIC, LastName VARCHAR(30) CHARACTER SET LATIN NOT CASESPECIFIC, DOB DATE FORMAT 'YYYY-MM-DD', JoinedDate DATE FORMAT 'YYYY-MM-DD', DepartmentNo BYTEINT ) UNIQUE PRIMARY INDEX ( EmployeeNo );
teradata_tables.htm
Advertisements