SQL Exercise using Teradata Student Network - PowerPoint PPT Presentation


PPT – SQL Exercise using Teradata Student Network PowerPoint presentation | free to view - id: 429e30-MWM0Z


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation

SQL Exercise using Teradata Student Network


SQL Exercise using Teradata Student Network Sean Eom MI375 MI410 Before the start of this assignment You are expected to read the power point file (Intro to sql) from ... – PowerPoint PPT presentation

Number of Views:295
Avg rating:3.0/5.0
Slides: 39
Provided by: eom


Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: SQL Exercise using Teradata Student Network

SQL Exercise using Teradata Student Network
  • Sean Eom
  • MI375 MI410

Before the start of this assignment
  • You are expected to read the power point file
    (Intro to sql) from the class website at week 5
    row. I suggest to print and read many times.
  • If you dont understand and have questions, post
    them on the forum. If you believe that you have a
    good understanding, proceed to the next slide.

Teradata Student Network?
  • Teradata University Network (TUN) is, created by
    Teradata (a division of NCR Corporation), an
    online learning portal on state of the art
    technology designed to foster education of data
    warehousing, business intelligence (BI) and
    database administration. Southeast Missouri
    State University is now one of nearly 170
    universities from 27 countries representing in
    the network.

  • "The resources Teradata has made available with
    the Teradata University Network make it possible
    to provide educational experiences to students
    that otherwise would be difficult or impossible
    to give, such as training on state- of-the-art
    technology," said Dr. Hugh Watson, Terry College
    of Business, University of Georgia. "What makes
    this site unique is that it is designed and
    managed by faculty to meet the specific needs of
    those who are teaching students how to use these
    decision-support tools."

  • Since 2004, TUN has been used to help MI375
    students understand the structured query
    languages (SQL). Before the inclusion of SQL
    assignments using TUN software, students used
    only Microsoft Access to extract information from
    the database. Now MI375 students, online as well
    as face-to-face class, learn how to extract
    information from database using structured query

Entering Teradata Student Network
  • Click teradata student network on the course
    schedule page. The screen below appears.
  • Enter password SPARTANS. All upper cases. Do
    not enter quotation .

This is the second screen of TUN
Register before the use of TUN
  • The previous screen shows three red headlines
    under Welcome (orange color).
  • Welcome to Teradata University Network
  • Register Today
  • Access TSN
  • Click register (hyperlinked), the first line
    under the heading register today.

The screen after clicking register.
  • Fill out the registration form now. After
    successful registration, you will see the
    following. Click Return to Teradata Student
    Network Homepage

  • You are creating two sets of user_ID and
  • You have just created the first one to enter the
    Teradata Student Network(TSN). Please jot down
    the user_ID and password to TSN.
  • In a few moments, you will register again to
    enter Teradata SQL website. You will create
  • SQL User_ID and SQL password
  • Dont forget two write down these two.

TUN Home After Registration, Click/select
Software (blue-hyperlinked)
After software selection, this is the screen.
Now, select Teradata Database
After clicking Teradata Database, this is what
you see. You need to register again to enter
Teradata SQL assistant by clicking Register to
Use Teradata SQL Assistant/Web Edition in
a Course
This is registration form to fill out. You will
find our university and my name. The course
dropdown menu will list MI410, MI430, and MIS.
MIS is the course you will select. There is NO
course password.
  • Enter university, Instructor, and course. There
    is no course password. Do not enter.
  • Add the following
  • SQL UserID (this is your user id, you decide it)
  • SQL PW (you decide it)
  • E-mail address (your e-mail address)
  • Hint Phrase
  • Hint Answer
  • Click Register, Congrat! You are done!! Jot
    down your SQL User ID and SQL password.

We are back to Teradata Database Section, Click
Execute Teradata SQL Assistant/Web Edition
  • In the previous slide, you see execute teradata
    assistant/web edition (bottom last row).
  • Click it.
  • On the next screen, enter
  • your SQL user ID,
  • SQL password, and
  • default database (db_watson)
  • Click OK.

Entering SQL Assistant/web edition
SQL Assistant First Screen Notice that there are
three sign at the left hand side.
From the SQL assistant screen, click sign at
the left of db_watson database symbol. Then the
sign changes into - and you will see four
signs with Tables, Views, Macros, and
From the previous screen, click sign at the
left of table symbol under db_watson database.
Entering SQL Commands
Executing command and output
  • After entering the command, click the execute
    button on the previous slide.
  • The output of the query is to be displayed in
    the answer set window area (see next slide).

Executing the commands and output
Reading error messages
  • Suppose you entered an SQL command with a syntax
    error, then of course you will not get correct
    SQL outputs. Instead, you will get an error
    message. Here is an example.
  • You entered Selct from shr instead of
    Select from shr
  • the very bottom of the next screen says 3706
    Syntax error expected something between the
    beginning of the request and the word selct.

(No Transcript)
SQL Exercise
  • The SQL exercise is based on the following single
    table database. The table name is SHR (Share).
  • The SHR table has several attributes (fields).
  • Shrcode (Firms code) - character
  • Shrfirm (Firms name) - character
  • Shrprice (Firms stock price) - number
  • Shrqty (Quantity of stock owned) -number
  • Shrdiv (Share Dividend) - number
  • Shrpe (Price-to-earnings ratio) - number

Attributes in the SHR table
  • As discussed in the previous slide, the Table
    consists of 6 fields (attributes). To see the
    list of attributes in SHR table, Do the
  • From the list of DB_Watson Tables, find SHR
    tables. (see the next slide). Click , which
    means we will explore what is inside the share

(No Transcript)
After clicking of SHR table, you will see the
following, then click of Columns results in
the right figure showing all attributes (fields).
Share Table before building queries, make sure
that you understand the database contents below.
Now, I will show two examples of how to write a
query using structured query language (SQL) and
execute it to display output. As stated earlier,
please study Intro to SQL power point file on
the class schedule page.
  • Select from shr
  • Asterisk () means all
  • Semicolon() is used at the end of every SQL
  • SQL commands are case-insensitive
  • SQL commands used in the teradata network work
    with or without semicolon ()
  • Select shrcode, shrfirm from shr

Select shrcode, shrfirm from shr
What to do? Save and upload
  • You will save 12 queries and corresponding 12
    outputs as described below. Upload your 24 text
    files to WEEK 5 dropbox.
  • Save SQL Statements/Outputs
  • On the entering sql command slide, you will
    see Save Query button. Click it and choose
    save and save it on your disk (a, c, f, or
    g ) for submission to me for grading purpose.
  • you need to save each of 12 queries and
    corresponding 12 outputs. Add your last name as
    prefix query number. E.g., the first query is
    saves as eomquery1.txt, the corresponding output
    is saved as eomanswerset1.txt). All the rest of
    the assignments must be saved with different

  • Q1. Get all firms with a price-earnings ratio
    less than 12. Q2. List the firms name, price,
    quantity, and dividend where the holding is at
    least 100,000.
  • Q3. Find all firms where the PE is 12 or higher
    and the share holding is less than 10,000.
  • Q4. Report firms with code AR.

  • Q5. Report data on forms with codes of FC, AR or
    SLG (Hint Use IN)
  • Q6. List all firms where PE is at least 10, and
    order the report in descending PE (Hint User
    ORDER BY).
  • Q7. How many firms are there in the portfolio?
    (Hint Use Count ())
  • Q8. How many firms have a holding greater than
  • Q9. Find the average dividend.

  • Q10. List all firms with a name starting with
    F. (Hint use LIKE)
  • Q11. List all firms containing Ruby in their
    name. (Hint Use Like and )
  • Q12. Find maximum share price.
About PowerShow.com