EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Data Science Data Science Tutorials DBMS Tutorial Teradata Create Table
 

Teradata Create Table

Updated July 6, 2023

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.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

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.

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

We hope that this EDUCBA information on “Teradata Create Table” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

  1. Teradata data types
  2. Collect Stats in Teradata
  3. Primary Index in Teradata
  4. Teradata Partition by

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - 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
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

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

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*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?

🚀 Limited Time Offer! - 🎁 ENROLL NOW