#### Overview of this book

Data Analysis Using SQL and Excel, 2nd Edition shows you how to leverage the two most popular tools for data query and analysis—SQL and Excel—to perform sophisticated data analysis without the need for complex and expensive data mining tools. Written by a leading expert on business data mining, this book shows you how to extract useful business information from relational databases. You'll learn the fundamental techniques before moving into the "where" and "why" of each analysis, and then learn how to design and perform these analyses using SQL and Excel. Examples include SQL and Excel code, and the appendix shows how non-standard constructs are implemented in other major databases, including Oracle and IBM DB2/UDB. The companion website includes datasets and Excel spreadsheets, and the book provides hints, warnings, and technical asides to help you every step of the way. Data Analysis Using SQL and Excel, 2nd Edition shows you how to perform a wide range of sophisticated analyses using these simple tools, sparing you the significant expense of proprietary data mining tools like SAS.
Free Chapter
Foreword
Introduction
Chapter 1: A Data Miner Looks at SQL
Chapter 2: What’s in a Table? Getting Started with Data Exploration
Chapter 3: How Different Is Different?
Chapter 4: Where Is It All Happening? Location, Location, Location
Chapter 5: It’s a Matter of Time
Chapter 6: How Long Will Customers Last? Survival Analysis to Understand Customers and Their Value
Chapter 7: Factors Affecting Survival: The What and Why of Customer Tenure
Chapter 8: Customer Purchases and Other Repeated Events
Chapter 9: What’s in a Shopping Cart? Market Basket Analysis
Chapter 10: Association Rules and Beyond
Chapter 11: Data Mining Models in SQL
Chapter 12: The Best-Fit Line: Linear Regression Models
Chapter 13: Building Customer Signatures for Further Analysis
Chapter 14: Performance Is the Issue: Using SQL EffectivelyChapter 14
EULA
Appendix Equivalent Constructs Among Databases

# Mathematical Functions

These functions operate on numeric values.

## Remainder/Modulo

Which function returns the remainder when one number, <num>, is divided by another, <base>?

### IBM DB2

`MOD(<num>, <base>)`

### MySQL

`MOD(<num>, <base>) or <num> MOD <base> or <num> % <base>`

### Oracle

`MOD(<num>, <base>)`

### Postgres

`<num> % <base> or MOD(<num>, <base>)`

### SAS proc sql

`MOD(<num>, <base>)`

### SQL Server

`<num> % <base>`

## Power

How do you raise one number, <base>, to another number, <exp>?

### IBM DB2

`POWER(<base>, <exp>)`

### MySQL

`POWER(<base>, <exp>)`

### Oracle

`POWER(<base>, <exp>)`

### Postgres

`POWER(<base>, <exp>) or <base>^<exp>`

### SAS proc SQL

`<base>**<exp>`

### SQL Server

`POWER(<base>, <exp>)`

## Natural Logs and Exponential Function

What are the functions for the natural log and exponential function...