SQL Server 2019 SQL Comprehensive

Purchasing Alternatives

Help is here: If something is not working with the links, payments, or downloads, do not hesitate to email us at demerp@alphapresspublishing.com and we will respond ASAP with instructions and solutions.

Download the sample database for MS SQL SERVER 2019 SQL Comprehensive

Click here to download the SQL Server sample database

Book Description

This book is intended to train the market professional or college student on SQL for information generation and data analytics. All the examples in the book concentrate on business questions such as calculating the number of sales by customers, business revenue by city and year, identifying customers who have not ordered lately, customer segmentation, cycle-time calculations, inventory replenishment, and hundreds of similar questions. This book has been primarily used by business professionals as well as a textbook in the business schools of several colleges and universities.


For the instructor, Pindaro tried to make this book as friendly as possible. He personally tested the book in his own classes to see how the labs work in the class/training environment. He has also prepared a separate booklet that the instructor can receive as a pdf/word file (upon confirmation of instructor status) that includes the solutions to all the case studies.


There are two fundamental principles followed by the author in this book. First, there should be no software to buy. Second, there must exist clear, step by step instructions on how to download the free version of SQL Server, how to install it, how to download the sample database, how to install it, and finally how to start using the book. A whole chapter has been devoted to help the professional or student go through this process.


It is also extremely important to be able to start from zero and become a professional in the usage of SQL for analytics. Please take into consideration that this book concentrates on data manipulation and analytics. If you need a SQL book towards database administration and transaction processing such as creating users, setting security policies, and management plans, you will need to refer to other excellent books which concentrate on database administration (DBA) tasks.


This book concentrates on the production of analytics. To that purpose it contains 293 exercises in its 33 chapters which the student can complete at his or her own time or during class with an instructor. It also contains at the end of each chapter, ten discussion questions and two case studies with five problems each for sharpening the skills taught in the chapter.


This book is the culmination of Pindaro's 22 years of pedagogical experience in the area of data and analytics at the University level. In addition, the author has thirty years of experience in the market collaborating with more than fifteen companies. After multiple decades with hundreds of labs and thousands of questions and comments from the students as well as market professionals, Pindaro wrote this book to assist the readers in becoming SQL professionals so that they can be successful with their data manipulation tasks in their working environment.


Currently, no matter the position, industry, or job function, it looks like everyone is asking for SQL skills. SQL is needed for data integration (ETL), data warehousing, big data, machine learning, data mining, artificial intelligence on premise or on the cloud.

Book Table of Contents

PREFACE PREPARE THE LAB ENVIRONMENT FOR THIS BOOK.. 16

CHAPTER 1 SQL FOUNDATIONAL CONCEPTS FOR BUSINESS.. 29

CHAPTER 2 RETRIEVING SETS AND SUBSETS OF DATA THE SELECT STATEMENT.. 50

CHAPTER 3 INSERTING, MOVING AND APPENDING DATA.. 60

CHAPTER 4 FILTERING DATA - THE OR and AND OPERATORS.. 68

CHAPTER 5 SORTING RECORDS THE ORDER BY CLAUSE.. 76

CHAPTER 6 FILTERING DATA WITH WILDCARD CHARACTERS.. 86

CHAPTER 7 CREATE SEARCH PATTERNS WITH THE LIKE OPERATOR.. 94

CHAPTER 8 ABSOLUTE SEARCHES WITH EQUALITY AND INEQUALITY PREDICATES.. 106

CHAPTER 9 FILTERING BOUNDARIES WITH THE BETWEEN OPERATOR.. 114

CHAPTER 10 CUSTOM AND DYNAMIC FILTERS WITH THE IN OPERATOR.. 121

CHAPTER 11 RETRIEVING UNIQUE FIELD VALUES - THE DISTINCT PREDICATE.. 132

CHAPTER 12 RETRIEVE TOP OR BOTTOM N OR % SET OF DATA.. 139

CHAPTER 13 PERFORM CALCULATIONS WITH DATA.. 146

CHAPTER 14 DATA CONCATENATION... 156

CHAPTER 15 GROUPING DATA - CALCULATIONS AND FILTERING WITH GROUPED DATA.. 165

CHAPTER 16 CUMULATIVE ANALYTICS WITH AGGREGATE FUNCTIONS.. 177

CHAPTER 17 CROSS TABULATIONS WITH MULTIPLE VARIABLES.. 190

CHAPTER 18 DATA MANIPULATION WITH CONDITIONAL FUNCTIONS.. 202

CHAPTER 19 COMBINING DATA SETS – THE UNION OPERATOR.. 216

CHAPTER 20 IDENTIFY DUPLICATE, ORPHANED, and UNRELATED RECORDS.. 228

CHAPTER 21 IDENTIFY AND ELIMINATE NULL VALUES IN DATA SETS.. 241

CHAPTER 22 CONVERT FIELD DATA TYPES.. 250

CHAPTER 23 ENHANCED ANALYTICS WITH TEXT FUNCTIONS.. 258

CHAPTER 24 SUPERIOR ANALYTICS WITH DATE FUNCTIONS.. 275

CHAPTER 25 UPDATING ROWS USING CRITERIA.. 296

CHAPTER 26 DELETING ROWS USING CRITERIA.. 306

CHAPTER 27 JOINS - SEVEN WAYS TO JOIN DATA SETS.. 318

CHAPTER 28 DYNAMIC FILTERS AND INFERENCES WITH SUB-QUERIES.. 335

CHAPTER 29 STORED PROCEDURES FOR ANALYTICS.. 347

CHAPTER 30 TRIGGERS.. 357

REFERENCE CHAPTER - CREATING AND EDITING TABLES.. 371

REFERENCE CHAPTER - CREATING AND EDITING INDEXES.. 379

REFERENCE CHAPTER - CREATING AND EDITING ENTITY RELATIONSHIPS.. 385

INDEX OF TERMS 398