EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials Database Management Tutorial Teradata Create Table
Secondary Sidebar
Database Management Tutorial
  • DataBase Management
    • Text Data Mining
    • Roles of Database Management System in Industry
    • SQL Server Database Management Tools
    • Databricks CLI
    • Database administrator skills
    • Database Management Systems Advantages
    • Database Testing Interview Questions
    • Netezza Database
    • Data Administrator
    • Database Administrator
    • Data manipulation
    • Database Management Software
    • DataStage
    • Types of Database Models
    • Types of Database
    • Hierarchical Database Model
    • Relational Database
    • Relational Database Advantages
    • Operational Database
    • What is RDBMS?
    • Data Masking Tools
    • Database Security
    • Data Replication
    • Bitmap Indexing
    • Second Normal Form
    • Third Normal Form
    • Fourth Normal Form
    • Data Definition Language
    • Data Manipulation Language
    • Data Control Language
    • Transaction Control Language
    • Dataset Normalization
    • jdbc connection
    • Conceptual Data Model
    • Entity-Relationship Model
    • Relational Database Model
    • Sequential File Organization
    • Teradata Create Table
    • Teradata Database
    • Centralized Database
    • Data Storage in Database
    • Thomas write Rule
    • DBA Interview Questions
    • What is JDBC?
    • jdbc hive
    • Apriori Algorithm
    • JDBC Architecture
    • JDBC Interview Questions
    • Datastage Interview Questions
    • Wildcard Characters
    • Distributed Database System
    • Multidimensional Database
  • TSQL Basic
    • TSQL
    • What is T-SQL
    • T-SQL Commands
    • T-SQL String Functions
    • TSQL Interview Questions

Teradata Create Table

Teradata Create Table

Introduction to Teradata Create Table

The following article provides an outline for Teradata Create Table. Every sequential database involves the storage of its data in the form of tables. Tables are structures of data which are in row and column format. The columns are vertical entities, whereas the rows are horizontal entities. Here the position in which the row and the columns meet is called a field. Here a table can also be mentioned as an organized collection of the same types of data. The number of rows and tables in a table depends on the space allocated to the table; to create a table in a database, the create table statement is used.

The create table statement is responsible for creating a table in the database. Here Teradata systems also uses the create table statement for the creation of the tables. Teradata more specifically allows the flexibility of allocating the table space or the memory needed for each and every table created more specifically.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Syntax of Teradata Create Table

Given below is the syntax mentioned:

CREATE SET/MULTISET TABLE Name_of_database.Name_of_Table, [NO] FALLBACK
(Name_of_Column#1 Column_Name#1_data_type attribute,
Name_of_Column#2 Column_Name#2_data_type attribute,
Name_of_Column#3 Column_Name#3_data_type attribute,
Name_of_Column#4 Column_Name#4_data_type attribute,
Name_of_Column#N Column_Name#N_data_type attribute)
UNIQUE PRIMARY INDEX (Name_of_Primary_Index_column);

  • When SET is mentioned in the table creation, it does not permit duplicate rows; in the MULTISET table, duplicate values are allowed. Here the database name and the table name must be mentioned.
  • When a FALLBACK is cited, then the device will generate a replica desk, and this replica desk might be useful when there may be a failure to the device.
  • The default fee is NO FALLBACK. For every column in the database, their corresponding column datatypes need to be specified; these data types need to be ensured to match the nature of the column.
  • Also, the primary index of the table can be created; here, the column which is expected to be used as the primary index needs to be mentioned in the UNIQUE primary index keyword.

Options in Creating Teradata Tables

There are several options in the ways a table can be created in Teradata; these options are given below:

Options Definition

Example

GLOBAL TEMPORARY TABLE Creating tables with this option allows the contents of the table to be active for only one specific session. When the session ends, the contents of the table will be deleted. CREATE GLOBAL TEMPORARY TABLE EDUCBA.Global_Table
(
ID INT,
Employee_Name VARCHAR (50)
);
JOURNAL TABLE The permanent journal table will allow maintaining a log of information about the inserts, updates etc., to the table. This is sequential information about the changes to the table. During processes like COMIT or ABORT, these journal tables will be helpful in securing the user data. The JOURNAL option will be default created for a database which means every table in a database will have a Journal activated in the backend by default. If we expect them to set off the JOURNAL option for a specific table, then the query shared will be helpful. CREATE GLOBAL TEMPORARY TABLE EDUCBA.Global_Table FALLBACK, NO AFTER JOURNAL
(
ID INT,
);
FREESPACE The free space option allows to confirm the amount of space available on the storage cylinders during the load operation being performed. NA
DATABLOCKSIZE This option allows to confirm the total number of sectors for each block. Each sector is 512 MB in size. NA
INDEX This represents the unique secondary index for the table. Here the secondary index values will be stored to a sub table. Hence more storage will be needed. The secondary indexes can be created with both unique and Non-Unique indexes. The USI sub table rows are hashed, whereas the NUSI is AMP which means each row in the NUSI table will directly match to the corresponding primary table. The secondary index creation process can be applied during the table creation or even after the table is created. The Secondary Index creation option is Optional. USI:

CREATE UNIQUE INDEX(ID) on EDUCBA.Global_Table;

NUSI:

CREATE INDEX(ID) on EDUCBA.Global_Table;

 

 

 

Examples of Teradata Create Table

Given below are the examples of Teradata Create Table:

Example #1

The first example represents the creation of a SET table, so this table does not allow any duplicate rows. Here 3 columns are created for the table, such as ID, NAME, AGE. Each of these columns is associated with its corresponding data types. The output snaps involve snaps of the table are created, and then the schema of the table is verified. After that, the insert operation is executed on the table. The inserted records are displayed in the snap too.

Code:

CREATE SET TABLE EDUCBA.TEST (ID INTEGER, NAME VARCHAR(50),AGE INTEGER);
INSERT INTO EDUCBA.TEST(ID, NAME, AGE) VALUES (10,’ÁNAND’,34)
INSERT INTO EDUCBA.TEST(ID, NAME, AGE) VALUES (13,’MANJU’,36)
INSERT INTO EDUCBA.TEST(ID, NAME, AGE) VALUES (14,’SAVITHA’,34)
INSERT INTO EDUCBA.TEST(ID, NAME, AGE) VALUES (12,’RAJESH’,34)
SELECT * FROM EDUCBA.TEST;

Output:

Teradata Create Table 1

Teradata Create Table 2

Example #2

The first example represents the creation of a MULTISET table, so this allows duplicate rows. Here 5 columns are created for the table, such as ID, NAME, AGE. Each of these columns is associated with its corresponding data types. We can notice from the output file that the insertion of duplicate values in all the columns are comfortably inserted in the table. These duplicate values are printed on to the console, and a snap of the console is captured and attached below. Also, all the insert queries are shared below in the query section.

Code:

CREATE MULTISET TABLE EDUCBA.TEST_MULTI(ID INTEGER, NAME VARCHAR(50),AGE INTEGER);
INSERT INTO EDUCBA.TEST_MULTI (ID, NAME, AGE) VALUES (10,’ÁNAND’,34)
INSERT INTO EDUCBA.TEST_MULTI (ID, NAME, AGE) VALUES (10,’ÁNAND’,34)
INSERT INTO EDUCBA.TEST_MULTI (ID, NAME, AGE) VALUES (10,’ÁNAND’,34)
INSERT INTO EDUCBA.TEST_MULTI (ID, NAME, AGE) VALUES (10,’ÁNAND’,34)
INSERT INTO EDUCBA.TEST_MULTI (ID, NAME, AGE) VALUES (10,’ÁNAND’,34)
SELECT * FROM EDUCBA.MULTI_TEST;

Output:

represents the creation of a MULTISET table

allows duplicate rows

Conclusion

The create table statement in Teradata systems are very deeply defined such that it is designed to have the capability of formulating tables which can store a solidified amount of data, and also, they have the ability to flexibly mention the memory and index level options for these table items. This is one among the key capabilities that make Teradata among the successful sequential storage-based enterprises around the globe.

Recommended Articles

This is a guide to Teradata Create Table. Here we discuss the introduction, options in creating Teradata tables and examples, respectively. You may also have a look at the following articles to learn more –

  1. Teradata data types
  2. Collect Stats in Teradata
  3. Primary Index in Teradata
  4. Teradata Partition by
Popular Course in this category
SQL Training Program (10 Courses, 8+ Projects)
  10 Online Courses |  8 Hands-on Projects |  80+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

PL SQL Training (4 Courses, 2+ Projects)4.9
Oracle Training (17 Courses, 8+ Projects)4.8
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more