Run sample queries

Teradata Developer Guides

ft:locale
en-US
ft:lastEdition
2026-08-18
  • Using dbc user, we will create a new database called HR. Copy/paste this query and run press Enter:
CREATE DATABASE HR
AS PERMANENT = 60e6, -- 60MB
    SPOOL = 120e6; -- 120MB
  • Let’s create a sample table and insert some data and query it. We will first create a table to hold employee information:
CREATE SET TABLE HR.Employees (
   GlobalID INTEGER,
   FirstName VARCHAR(30),
   LastName VARCHAR(30),
   DateOfBirth DATE FORMAT 'YYYY-MM-DD',
   JoinedDate DATE FORMAT 'YYYY-MM-DD',
   DepartmentCode BYTEINT
)
UNIQUE PRIMARY INDEX ( GlobalID );
  • Now, let's insert a record:
INSERT INTO HR.Employees (
   GlobalID,
   FirstName,
   LastName,
   DateOfBirth,
   JoinedDate,
   DepartmentCode
)
VALUES (
   101,
   'Adam',
   'Tworkowski',
   '1980-01-05',
   '2004-08-01',
   01
);
  • Finally, let's see if we can retrieve the data:
SELECT * FROM HR.Employees;

You should get the following results:

GlobalID  FirstName  LastName   DateOfBirth  JoinedDate  DepartmentCode
--------  ---------  ---------- -----------  ----------  --------------
     101  Adam       Tworkowski  1980-01-05  2004-08-01               1