ENGLISH

SQL for IBM i: A Database Modernization Guide

Book information

Publisher
MC Press
Year
2018
ISBN
9781583474495, 1583474498
Language
english
Format
PDF
Filesize
6 MB (6218974 bytes)
Edition
None
Pages
376\375
Time added
2023-03-03 05:47:36

Description

This book aims to give IBM i technical users basic to intermediate SQL knowledge and tools they can use to get more out of the IBM i database. The book can be useful to veteran IBM i programmers, who have RPG and COBOL roots, system administrators looking to get more information out of their IBM i system, or even Java and .NET developers who need to “talk” to IBM i database. The author provides comprehensive examples and exercises to help readers understand and practice what they have learned. Front Cover Title Page Copyright Contents Acknowledgments Why You Need This Book How Can You Get More Out of the Database? 1: Meet the UMADB: Our Example Database The Students Table The Courses Table The Teachers Table The Classes Table The Grades Table Just a Few Tables, and So Many Problems In This Chapter, You’ve Learned ... 2: A Data Manipulation Language Basics Recap Using the BETWEEN and IN Predicates Joining Tables The JOIN You’ve Been Using Without Realizing: INNER JOIN Start Joining Tables Left and Right “Just Get Me Everything”: FULL JOIN A Join Summary A Handful of Column Functions The COUNT Function Finding the Minimum and Maximum Values of a Column Sums and Averages Made Easy The Shape-shifting CAST Function Aggregating Data with GROUP BY The Two Flavors of INSERT Vanilla INSERT: Plain, Simple, and Kind of Boring Strawberry (or Whatever Your Favorite Ice Cream Flavor Is) INSERT Data Adjustments with UPDATE DELETE: A Blessing and a Curse In This Chapter, You’ve Learned ... 3: A Data Definition Language Basics Recap Converting UMADB’s Physical Files to SQL Tables CREATE TABLE Fundamentals Moving a Step Closer to a Real SQL Table Adding a Unique, Self-Managed Key Providing Proper Default Values for Optional and Audit-Related Columns Time for Some Practice A First Step Toward Easier Data Access: Creating a Few Simple Views Why Do You Need Views? How Do You Create Views? Repeat After Me: A View Is Not a Logical File The Missing Piece: SQL Indexes A Side Note: Why Is It So Important to Keep the Source Statements Safe? Exploring a Few CREATE INDEX Options In This Chapter, You’ve Learned … 4: Making the Database User-Friendly Using Longer Table and Column Names Time for Some Practice Hiding Database Complexity Using the Same Table Twice in a Query Using Sub-queries Using EXISTS to Omit Records on a SELECT Statement Checking Database Consistency with the Exception Join Time for Some (More) Practice Using CASE to Return “Friendlier” Column Values Using CASE in the ORDER BY Clause Using a Secondary Table to Produce Customizable Sorting Sequences In This Chapter, You’ve Learned ... 5: Tidying Up the Database A Quick Refresher on Relational Databases Relational Databases and Their Use of Keys Primary Keys Unique Keys Foreign Keys Table Relationship Types Understanding Identifying and Non-Identifying Relationships Referential Integrity Entity Relationship Diagram Notation Solving UMADB’s Database Problems Through Normalization Data Anomalies Some Boring, Yet Important, Math Jargon Introducing the Normal Forms, Academic Version Normalizing UMADB to 3NF Data Modeling with Visual Paradigm Introducing Visual Paradigm Community Edition Time for Some Practice Creating the New and Improved UMADB Time for Some (More) Practice Data Modeling Is Fun, but Where’s the Code? Migrating the Data to the New, Improved UMADB Populating the Teacher Ranks Table Populating the Departments Table Creating the Persons Data Populating the Teachers Table Populating the Students Table Populating the Courses Table Creating the Class Definitions Data Creating the Classes per Year Data Creating the Class Enrollment per Year Data Populating the Sort Sequence Table Time for a Bit More Practice Hiding the Database Complexity (Again) by Recreating the Views In This Chapter, You’ve Learned ... 6: Introducing Data-Centric Programming and SQL/PSM A Call from the Dean’s Office Introducing Data-Centric Programming An SQL/PSM Crash Course Variable Declaration Variable Assignment Flow Control Loop Control Calling Other SQL Routines, FOR Loops, and Cursors Dynamic SQL Compound Statements Error Handling In This Chapter, You’ve Learned ... 7: Creating and Using Stored Procedures SPs, UDFs, and Triggers: When to Use Each Analyzing the SP’s Structure What’s in a Name? Procedure Parameters Procedure Properties Procedure Options Procedure Body Creating Your First Stored Procedure Time for Some Practice Data-returning Stored Procedures Creating Data-returning Stored Procedures Creating More Complex Data-returning Stored Procedures Time for Some (More) Practice Using Data-returning Stored Procedures How to Use the Result Sets Returned by a Stored Procedure And There’s Still Time for a Little More Practice In This Chapter, You’ve Learned ... 8: Exploring User-Defined Functions Function Versus Procedure: The RETURNS Property Pick Your UDF Flavor A Couple of Simple UDFs to Get You Started Using Flow Control in a UDF UDF Overloading Testing the Get_Student_Id UDF Time for Some Practice A More Complex UDF: Calculating the Student GPA Creating a Generic “Translation” Table ... ... And a Couple of Functions to Access It Finding a Place for the Credit Hours per Class Creating the Calculate_GPA UDF Creating a Simple UDTF Anatomy of a UDTF Using a UDTF in a SELECT Statement Writing More Complex UDTFs Scheduled User Profile Review UDTF Using a UDTF’s Data in Another UDTF: Introducing the User Review Report In This Chapter, You’ve Learned ... 9: Making a Trigger-Happy Database Introducing Database Triggers What Triggers a Trigger? Why Use Triggers? SQL Triggers’ Advantages SQL Trigger Mechanics A Simple Trigger Example Testing Your First Trigger Time for Some Practice Exploring More Complex Trigger Scenarios Using Triggers for Data Validation Testing the Teacher Salary Update Check Trigger Using Triggers for Auditing Testing the Trigger Using Triggers to Compose and Fill Columns Using INSTEAD OF Triggers to Supercharge Views Use Triggers with Care Triggers Are Like Salt In This Chapter, You’ve Learned ... 10: Moving Business Validations to the Database Re-introducing DDL Constraints Unique Constraints Referential Constraints Check Constraints Enforcing More Complex Sets of Business Rules Keeping the Teachers’ Salaries in Check Tidying Up the Personnel (Records) Enforcing the “Informal” Integrity of the Courses Table In This Chapter, You’ve Learned ... 11: Exploring the Database Catalog Information Data About Data and the System Catalog Where It All Starts: Tables In This Chapter, You’ve Learned ... 12: Parting Gifts The Personnel Contact Information Update Scenario Creating a Table Based on a SELECT Statement Anatomy of the MERGE Statement A Quick-and-Dirty UPDATE-only Alternative to MERGE Common Table Expressions CTE Anatomy A Simple CTE Example Another CTE Example: Recreating the Student Grades Info View Never Stop Learning! Index

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

1809 · PDF