Teradata SQL

Introduction to Teradata SQL



SQL – It stands for Structured Query Language. This is the language for accessing and manipulating any Relational Database Management Systems. SQL is a non-procedural and set oriented language, meaning it contains no procedural-type statements. 

Teradata SQL is based on ANSI standards. ANSI stands for American National Standards Institute. Teradata SQL is fully certified at the SQL92 Entry level, with some intermediate, some full and some SQL-99 Core features also implemented. To enhance the capabilities of SQL, Teradata has added extensions that are unique to Teradata. 

SQL Commands- There are three categories of SQL Commands: 

Data Definition Language (DDL) 
Data Manipulation Language (DML) 
Data Control Language (DCL)

Categories of SQL Commands



Data Definition Language (DDL) - this is used for creating various database objects like tables, views, macros, users etc.
The following table summarizes the basic DDL Statements : 

TYPE
PURPOSE
CREATETo define a database object like new table, new macro, trigger, index, stored procedure, view.
DROPTo remove database objects like table, index, macro, stored procedure, view.
ALTERModify table, column, trigger or referential constraints or recompile stored procedure
RENAMERename a table, view, trigger, stored procedure
SETSpecifies time zones and the collation or character set for a session
COLLECT STATISTICSCollect Stats on column/columns or index

Data Manipulation Language (DML) - This is used for the manipulation of data like inserting the records, deleting the records, updating the records etc.

TYPE
PURPOSE
INSERTInserting data into a table
UPDATEModifies data in one or more rows in a table
DeleteRemoving data from table
CommentInsert a text comment for a table
CheckpointCHECKPOINT is a function that writes records to a restart log table that you can use to restart in case of a hardware or software system failure.
DatabaseIndicates a default database
MergeCombines both UPDATE and INSERT in a single SQL statement.

Data Control Language(DCL):
database objects or controlling ownership of those objects by using DCL  commands.

SQL statement
Function
GRANT
To give user privileges.
REVOKE
To remove user privileges.
GIVE
To transfer database ownership.

No comments:

Post a Comment