Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata RDBMS Concepts.

Slides:



Advertisements
Similar presentations
Creating Tables. 2 home back first prev next last What Will I Learn? List and provide an example of each of the number, character, and date data types.
Advertisements

Virtual training week 4 structured query language (SQL)
Stored Procedure Language Stored Procedure Overview Stored Procedure is a function in a shared library accessible to the database server can also write.
Database Systems: Design, Implementation, and Management Tenth Edition
Introduction to Structured Query Language (SQL)
Creating Database Tables © Abdou Illia MIS Spring /21/2015.
30-Jun-15 SQL A Brief Introduction. SQL SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell”
Introduction to Structured Query Language (SQL)
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 7 Introduction to Structured Query Language (SQL)
Database Management System LICT 3011 Eyad H. Elshami.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
DATABASES AND SQL. Introduction Relation: Relation means table(data is arranged in rows and columns) Domain : A domain is a pool of values appearing in.
SQL Basics. SQL SQL (Structured Query Language) is a special-purpose programming language designed from managing data in relational database management.
PL / SQL P rocedural L anguage / S tructured Q uery L anguage Chapter 7 in Lab Reference.
Chapter 9 SQL and RDBMS Part C. SQL Copyright 2005 Radian Publishing Co.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Chapter 7 SQL HUANG XUEHUA. SQL SQL server2005 introduction Install components  management studio.
Oracle Data Definition Language (DDL) Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Chapter 5: Part 1: DDL STRUCTURED QUERY LANGUAGE (SQL)
Using Procedures & Functions Oracle Database PL/SQL 10g Programming Chapter 9.
Nitin Singh/AAO RTI ALLAHABAD 1 SQL Nitin Singh/AAO RTI ALLAHABAD 2 OBJECTIVES §What is SQL? §Types of SQL commands and their function §Query §Index.
SQL: DDL. SQL Statements DDL - data definition language –Defining and modifying data structures (metadata): database, tables, views, etc. DML - data manipulation.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 7 Introduction to Structured.
PL / SQL By Mohammed Baihan. What is PL/SQL? PL/SQL stands for Procedural Language extension of SQL. PL/SQL is a combination of SQL along with the procedural.
PL/SQL Block Structure DECLARE - Optional Variables, cursors, user-defined exceptions BEGIN - Mandatory SQL Statements PL/SQL Statements EXCEPTIONS - Optional.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
MySQL More… 1. More on SQL In MySQL, the Information Schema is the “Catalog” in the SQL standard SQL has three components: Data definition Data manipulation.
School of Computing and Management Sciences © Sheffield Hallam University SQL is non-procedural –designed to be relatively approachable to non- programmers.
Database Lab Lecture 1. Database Languages Data definition language ( DDL ) Data definition language –defines data types and the relationships among them.
Prince Sultan University Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Visual Programing SQL Overview Section 1.
Retrieving Data in PL/SQL. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Recognize the SQL statements that can.
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Introduction to Teradata Client Tools. 2 Introduction to Teradata SQL  OBJECTIVES :  Teradata Product Components.  Accessing Teradata – Database /
Stored Procedures / Session 4/ 1 of 41 Session 4 Module 7: Introducing stored procedures Module 8: More about stored procedures.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
SQL: Structured Query Language It enables to create and operate on relational databases, which are sets of related information stored in tables. It is.
Lecture # 24 Introduction to SQL Muhammad Emran Database Systems.
SQL Triggers, Functions & Stored Procedures Programming Operations.
Physical Model Lecture 11. Physical Data Model The last step is the physical design phase, In this phase data is – Store – Organized and – Access.
In this session, you will learn to: Create and manage views Implement a full-text search Implement batches Objectives.
Views / Session 3/ 1 of 40 Session 3 Module 5: Implementing Views Module 6: Managing Views.
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
Creating Database Objects
Managing Tables, Data Integrity, Constraints by Adrienne Watt
Advanced Teradata SQL GLOBAL Temporary Vs VOLATILE Temporary Vs Derived tables WITH and WITH BY Special Index function Trigger Online Analytical Function.
SQL: Advanced Options, Updates and Views Lecturer: Dr Pavle Mogin
ORACLE SQL Developer & SQLPLUS Statements
STRUCTURED QUERY LANGUAGE
SQL OVERVIEW DEFINING A SCHEMA
Database systems Lecture 3 – SQL + CRUD
Oracle Data Definition Language (DDL)
ORACLE.
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Chapter 2: Creating And Modifying Database Tables
Chapter # 7 Introduction to Structured Query Language (SQL) Part I.
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Structured Query Language Path from Unorganized to Organized….
Stored Procedure Language
Creating Database Objects
SQL (Structured Query Language)
Presentation transcript:

Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata RDBMS Concepts

Objective Data Types Data Definition Language Data Manipulation Language Temporary Tables

Teradata Versus ANSI Compliant with SQL 92, SQL 98 and SQL 99 standards

Numeric Data types BYTEINT - 1 Byte. SMALLINT – 2 Bytes. INTEGER - 4 Bytes. DECIMAL (n, m) – Space required depends on Number of digits.  1 – 2 => 1 byte  3 – 4 => 2 bytes  5 – 9 => 4 bytes.  10 – 18 => 8 bytes. FLOAT – 8 bytes.

Date Data Types DATE – Stored as 4 byte integer using following formula: YYYMMDD = ((YYYY )) * (MM * 100) + DD TIME - hh:mm:ss.ssssss. Stored in 6 bytes. TIMESTAMP - DATE + TIME – 10 Bytes. TIME WITH TIME ZONE  hh:mm:ss.ssssss +/-hh.h. Stored in 8 bytes. TIMESTAMP WITH TIME ZONE –  DATE + TIME + ZONE. Stored in 12 bytes.

Character Data Types CHARACTER VARCHAR LONG VARCHAR BYTE VARBYTE

Default Value Control Phrases COMPRESS NOT NULL DEFAULT BETWEEN n AND n (Range) CONSTRAINT CASESPECIFIC FORMAT TITLE

DDL CREATE TABLE  Table Kind clause  Table Options clause  Column Definition clause  Index Definition clause  Temporary/Volatile Table Preservation clause COLLECT STATISTICS ON table_name COLUMN column_name INDEX ( column_name ) INDEX index_name

Create Table CREATE TABLE Employee ( EmpNo SMALLINT CHECK (EmpNo >= AND EmpNo <= 32001) NOT NULL, Name VARCHAR(12) UPPERCASE NOT NULL, Salary DECIMAL(8,2) FORMAT ’ZZZ,ZZ9.99’ CHECK (Salary >= 1.00 AND Salary <= ), dob DATE FORMAT ’MMMbDDbYYYY’ NOT NULL, ) UNIQUE PRIMARY INDEX (EmpNo), INDEX (Name) ;

Views A View is a virtual table that appears as base table. Dynamic window on the underlying database. Constructed from one or more base tables (or views). View Definitions stored in the data dictionary.

Macros A frequently used SQL statement or series of statements can be incorporated into a macro and defined using the SQL CREATE MACRO statement. A macro can  include an EXECUTE statement that executes another macro.  contain a data definition statement only if it is the only SQL statement in that macro.  contain parameters that are substituted with data values each time the macro is executed. Teradata Database treats it as a single request. To drop a macro, use the DROP MACRO statement

Why we need macros? MACROS are typically used to reduce the number of characters that must be entered to specify an operation. Saving the user time. Decreasing the chance of making errors.

Stored Procedures Consist of a set of control and condition handling statements, that make SQL a computationally complete programming language. A single statement stored procedure body can contain one control statement,such as LOOP or WHILE, or one SQL DDL, DML, or DCL statement. Some statements are not allowed, including:  Any declaration (local variable, cursor, or condition handler) statement  A cursor statement (OPEN, FETCH, or CLOSE)

Stored Procedures A compound statement stored procedure body consists of a BEGIN-END statement enclosing a set of declarations and statements, including:  Local variable declarations  Cursor declarations  Condition handler declaration statements  Control statements  SQL DML, DDL, and DCL statements supported by stored procedures Compound statements can also be nested.

User-Defined Functions User-defined functions (UDFs) allow you to extend SQL by writing your own functions in the C programming language, installing them on the database, and then using them like standard SQL functions. You can also install UDF objects or packages from third- party vendors, without providing the source code. UDFs run in parallel, as required, on all AMPs. Scalar functions take input parameters and return a single value result. Aggregate functions produce summary results. They differ from scalar functions in that they take grouped sets of relational data, make a pass over each group, and return one result for the group.

Space Terminology Permanent Space ( Perm Space)  Maximum amount of space available for table and index Spool Space  Max amount of space available for requests Temp Space  Used for temporary tables

Database Space DBC SYSADMINCRASHDUMPSSYSTEMFE

Database Space Initially system user DBC owns all available space. Database Hierarchy – Owner, Parent, Children. When you create a new user it acquires space from its immediate parent. An user can transfer the ownership of the database to another user.

Temporary Tables Global TempTables Use Temp Space Globally Stored Definition Session Local Survive a System Restart Data Dictionary access Create Permission Required Up to 2000 tables Volatile Tables Use Spool Space Private Definition Session Local Don’t survive at system restart No Data Dictionary access Do not need any permissions Up to 1000 tables Derived Tables Uses Spool Space Statement Local Statement local Don’t survive at system restart No Data Dictionary access Do not need any permissions

Questions ?