5 ms·
Anyone know a really good SQL book or tutorial? Every book I've ever bought is usually way too simple. I'll flip to the "advanced" section thinking I'll finally
by esaym 8y ago
Anyone know a really good SQL book or tutorial? Every book I've ever bought is usually way too simple. I'll flip to the "advanced" section thinking I'll finally learn some tricks only to see the "advance" section just introduces the join syntax...
I'd like a good book that goes over queries common in reporting, you know a 3 page sql query that joins to sub queries that themselves are joining to sub queries. You know, the good stuff!
- ProfTeggy 8y agoFeel free to browse/download/peruse the many PDF slides of my course "Advanced SQL" (in which joins are considered basic). https://db.inf.uni-tuebingen.de/teaching/AdvancedSQLSS2017.html https://db.inf.uni-tuebingen.de/teaching/AdvancedSQLSS2017.h...
- laichzeit0 8y agoE. F. Codd - The Relational Model for Database Management - Version 2.
- reitanqild 8y agoDid you try SQL Cookbook? I think that was the one I used to enjoy. Lots of receipts. The first are quite simple but the later, more advanced ones should take you way beyond simple joins and would also have variations for the most common databases. From the table of contents: ... Chapter 5 Metadata Queries Listing Tables in a Schema Listing a Table's Columns Listing Indexed Columns for a Table Listing Constraints on a Table Listing Foreign Keys Without Corresponding Indexes Using SQL to Generate SQL Describing the Data Dictionary Views in an Oracle Database Chapter 6 Working with Strings Walking a String Embedding Quotes Within String Literals Counting the Occurrences of a Character in a String Removing Unwanted Characters from a String Separating Numeric and Character Data Determining Whether a String Is Alphanumeric Extracting Initials from a Name Ordering by Parts of a String Ordering by a Number in a String Creating a Delimited List from Table Rows Converting Delimited Data into a Multi-Valued IN-List Alphabetizing a String Identifying Strings That Can Be Treated as Numbers Extracting the nth Delimited Substring Parsing an IP Address Chapter 7 Working with Numbers Computing an Average Finding the Min/Max Value in a Column Summing the Values in a Column Counting Rows in a Table Counting Values in a Column Generating a Running Total Generating a Running Product Calculating a Running Difference Calculating a Mode Calculating a Median Determining the Percentage of a Total Aggregating Nullable Columns Computing Averages Without High and Low Values Converting Alphanumeric Strings into Numbers Changing Values in a Running Total Chapter 8 Date Arithmetic Adding and Subtracting Days, Months, and Years Determining the Number of Days Between Two Dates Determining the Number of Business Days Between Two Dates Determining the Number of Months or Years Between Two Dates Determining the Number of Seconds, Minutes, or Hours Between Two Dates Counting the Occurrences of Weekdays in a Year Determining the Date Difference Between the Current Record and the Next Record Chapter 9 Date Manipulation Determining if a Year Is a Leap Year Determining the Number of Days in a Year Extracting Units of Time from a Date Determining the First and Last Day of a Month Determining All Dates for a Particular Weekday Throughout a Year Determining the Date of the First and Last Occurrence of a Specific Weekday in a Month Creating a Calendar Listing Quarter Start and End Dates for the Year Determining Quarter Start and End Dates for a Given Quarter Filling in Missing Dates Searching on Specific Units of Time Comparing Records Using Specific Parts of a Date Identifying Overlapping Date Ranges Chapter 10 Working with Ranges Locating a Range of Consecutive Values Finding Differences Between Rows in the Same Group or Partition Locating the Beginning and End of a Range of Consecutive Values Filling in Missing Values in a Range of Values Generating Consecutive Numeric Values Chapter 11 Advanced Searching Paginating Through a Result Set Skipping n Rows from a Table Incorporating OR Logic when Using Outer Joins Determining Which Rows Are Reciprocals Selecting the Top n Records Finding Records with the Highest and Lowest Values Investigating Future Rows Shifting Row Values Ranking Results Suppressing Duplicates Finding Knight Values Generating Simple Forecasts Chapter 12 Reporting and Warehousing Pivoting a Result Set into One Row Pivoting a Result Set into Multiple Rows Reverse Pivoting a Result Set Reverse Pivoting a Result Set into One Column Suppressing Repeating Values from a Result Set Pivoting a Result Set to Facilitate Inter-Row Calculations Creating Buckets of Data, of a Fixed Size Creating a Predefined Number of Buckets Creating Horizontal Histograms Creating Vertical Histograms Returning Non-GROUP BY Columns Calculating Simple Subtotals Calculating Subtotals for All Possible Expression Combinations Identifying Rows That Are Not Subtotals Using Case Expressions to Flag Rows Creating a Sparse Matrix Grouping Rows by Units of Time Performing Aggregations over Different Groups/Partitions Simultaneously Performing Aggregations over a Moving Range of Values Pivoting a Result Set with Subtotals Chapter 13 Hierarchical Queries Expressing a Parent-Child Relationship Expressing a Child-Parent-Grandparent Relationship Creating a Hierarchical View of a Table Finding All Child Rows for a Given Parent Row Determining Which Rows Are Leaf, Branch, or Root Nodes Chapter 14 Odds 'n' Ends Creating Cross-Tab Reports Using SQL Server's PIVOT Operator Unpivoting a Cross-Tab Report Using SQL Server's UNPIVOT Operator Transposing a Result Set Using Oracle's MODEL Clause Extracting Elements of a String from Unfixed Locations Finding the Number of Days in a Year (an Alternate Solution for Oracle) Searching for Mixed Alphanumeric Strings Converting Whole Numbers to Binary Using Oracle Pivoting a Ranked Result Set Adding a Column Header into a Double Pivoted Result Set Converting a Scalar Subquery to a Composite Subquery in Oracle Parsing Serialized Data into Rows Calculating Percent Relative to Total Creating CSV Output from Oracle Finding Text Not Matching a Pattern (Oracle) Transforming Data with an Inline View Testing for Existence of a Value Within a Group Appendix A Window Function Refresher Grouping Windowing Appendix B Rozenshtein Revisited Rozenshtein's Example Tables Answering Questions Involving Negation Answering Questions Involving "at Most" Answering Questions Involving "at Least" Answering Questions Involving "Exactly" Answering Questions Involving "Any" or "All"
- stopyellingatme 8y agoI'm almost finished with this SQL book. I've been working with databases at work lately and this has helped me avoid some pitfalls in the data world. SQL Antipatterns http://www.r-5.org/files/books/computers/languages/sql/style/Bill_Karwin-SQL_Antipatterns-EN.pdf http://www.r-5.org/files/books/computers/languages/sql/style...
- tejtm 8y agoI remember "SQL for Smarties" being helpful. Looks as though it is still getting updated. [0]https://www.safaribooksonline.com/library/view/joe-celkos-sql/9780128007617/ https://www.safaribooksonline.com/library/view/joe-celkos-sq...
- forinti 8y agoJoe Celko's Puzzles and Answers is a nice complement to the Smarties book. Neither of them cover analytic functions, though. And they can really make a difference (for performance and succinctness). So it's worth it to look into them after going through these books.
- ivan78 8y agoIf you are looking for something advanced, you should check books written by C. J. Date. For example, his "An Introduction to Database Systems" considered as one of the best book on database theory.
- ris 8y agoTheory. However he insists on living in his relational purist fantasy land without nulls or outer joins or other pragmatic things that people who use databases to get real work done rely on every day.
- rockmeamedee 8y agoI enjoyed "The Art of SQL". It's purposefully about higher-level strategies for relational DB management and administration, performance, tips in schema setup, SQL features to use/avoid...
- ris 8y agoGalaXQL http://sol.gfxile.net/g3/ http://sol.gfxile.net/g3/ is a decent, but very basic, introduction slightly held back by its reliance on sqlite.