Netezza SQL
eBook - ePub

Netezza SQL

Tom Coffing, Mike Larkins

Share book
  1. 683 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Netezza SQL

Tom Coffing, Mike Larkins

Book details
Book preview
Table of contents
Citations

About This Book

This book contains nearly 700 pages of brilliant Netezza examples ranging from simple commands to advanced procedures. Netezza SQL, like all others in the Genius Series, guides readers in a clear and logical manner using pictures and real-life examples. This book is a must-have for any Netezza environment.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Netezza SQL an online PDF/ePUB?
Yes, you can access Netezza SQL by Tom Coffing, Mike Larkins in PDF and/or ePUB format, as well as other popular books in Informatik & Data-Warehousing. We have over one million books available in our catalogue for you to explore.

Information

Year
2014
ISBN
9781940540283

Chapter 1 – Basic SQL Functions

"Kites rise highest against the wind – not with it."
Sir Winston Churchill

Introduction

image
The Student_Table above will be used
in our early SQL Examples
This is a pictorial of the Student_Table which we will use to present some basic examples of SQL and get some hands-on experience with querying this table. This book attempts to show you the table, show you the query, and show you the result set.

SELECT * (All Columns) in a Table

SELECT *
FROM Student_Table ;
image
Mostly every SQL statement will consist of a SELECT and a FROM. You SELECT the columns you want to see on your report and an Asterisk (*) means you want to see all columns in the table on the returning answer set!

Fully Qualifying a Database, Schema and Table

image
To refer to objects in other databases on the Netezza system, you must use three-level naming, which consists of the database (also referred to as catalog name), the schema (which is the name of the database owner), and the object (table, view or synonym). The last example (Sales..Dept) is a convenient way of specifying a fully qualified object name. The system supplies the schema name by internally inserting the current schema name.

SELECT Specific Columns in a Table

SELECT First_Name
,Last_Name
,Class_Code
,Grade_Pt
FROM Student_Table ;
image
Column names must be separated by commas. The next page will show perfect syntax, which will capitalize keywords and place each column on its own line.

Commas in the Front or Back?

image
Commas in the front (example 1) is Tera-Tom's recommendation to writing, but the next page is an even better example for a company standard. Both queries above produce the same answer set and have the same performance.

Using Good Form

image
SELECT First_Name,
Last_Name,
Class_Code,
Grade_Pt
FROM Student_Table ;
This is a great way to show the columns you are selecting from the Table_Name. Let me show you an even better technique!

Using the Best Form for Writing SQL

image
Why is the example on the right better even though they are functionally equivalent?

Place your Commas in front for better Debugging Capabilities

image
Having commas in front to separate column names makes it easier to debug

Sort the Data with the ORDER BY Keyword

image
Rows typically come back to the report in random order. To order the result set, you must use an ORDER BY. When you order by a column, it will order in ASCENDING order by default. This is called the Major Sort!

ORDER BY Defaults to Ascending

image
When you use the ORDER BY statement, it will default to ascending order, but you can change that if you like. I will show you how in a few pages down.

Use the Name or the Number in your ORDER BY Statement

image
The ORDER BY can use a number to represent the sort column. The numbe...

Table of contents