TERADATA HELPFUL DBA SQL

HELPFUL DBA SQL

SELECT All Columns from a Table and Sort

images

Select Specific Columns and Limiting the Rows

images

Changing your Default Database

images

Keywords that describe you

images

Select TOP Rows in a Rank Order

images

A Sample number of rows

images

Getting a Sample Percentage of rows

images

Find Information about a Database

images

Find information about a Table

images

Using Aggregates

images

Performing a Join

images

Performing a Join using ANSI Syntax

images

Using Date, Time and Timestamp

images

Using Date Functions

images

Using the System Calendar

images

Using the System Calendar in a Query

images

Formatting Data

images

Using Rank

images

Using a Derived Table

images

Using a Subquery

images

Correlated Subquery

images

Using Substring

images

Basic CASE Statement

images

Advanced CASE Statement

images

Using an Access Lock in your SQL

images

Collect Statistics

images

CREATING a Volatile Table with a Primary Index

images

CREATING a Volatile Table that is Partitioned (PPI)

images

CREATING a Volatile Table that is deleted after the Query

images

Finding the Typical Rows per Value for specific column

images

Finding out how much Space you have

images

How much Space you have Per AMP

images

Finding your Space

images

Finding Space Skew in Tables in a Database

images

Finding the Number of rows per AMP for a Column

images

Finding Account Information

images

Ordered Analytics

images

SELECT ((firstresptime – firststeptime) HOUR(4) TO SECOND) AS runtime,TotalIOCount, AMPCPUTime, NumResultRows, querytext
FROM dbc.dbqlogtbl
WHERE USERNAME = ‘sysdba’
AND GETQUERYBANDVALUE(COALESCE(queryband,”),0, ‘TD15Test’) = ‘DBA_SPECPROMO_SQL10’
ORDER BY starttime DESC

SET QUERY_BAND = ‘TD15Test = DBA_SPECPROMO_SQL10;’ FOR SESSION;

SET QUERY_BAND = ‘BlockCompression=Y;’ FOR SESSION;