Нашли опечатку? Выделите ее мышкой и нажмите Ctrl+Enter
Название: SQL Cookbook
Автор: Molinaro A.
Аннотация:
You know the rudiments of the SQL query language, yet you feel you aren't taking full advantage of SQL's expressive power. You'd like to learn how to do more work with SQL inside the database before pushing data across the network to your applications. You'd like to take your SQL skills to the next level.
Let's face it, SQL is a deceptively simple language to learn, and many database developers never go far beyond the simple statement: SELECT FROM WHERE . But there is so much more you can do with the language. In the SQL Cookbook, experienced SQL developer Anthony Molinaro shares his favorite SQL techniques and features. You'll learn about:
-Window functions, arguably the most significant enhancement to SQL in the past decade. If you're not using these, you're missing out
-Powerful, database-specific features such as SQL Server's PIVOT and UNPIVOT operators, -Oracle's MODEL clause, and PostgreSQL's very useful GENERATE_SERIES function
-Pivoting rows into columns, reverse-pivoting columns into rows, using pivoting to facilitate inter-row calculations, and double-pivoting a result set
-Bucketization, and why you should never use that term in Brooklyn.
-How to create histograms, summarize data into buckets, perform aggregations over a moving range of values, generate running-totals and subtotals, and other advanced, data warehousing techniques
- The technique of walking a string, which allows you to use SQL to parse through the characters, words, or delimited elements of a string
Written in O'Reilly's popular Problem/Solution/Discussion style, the SQL Cookbook is sure to please. Anthony's credo is: "When it comes down to it, we all go to work, we all have bills to pay, and we all want to go home at a reasonable time and enjoy what's still available of our days." The SQL Cookbook moves quickly from problem to solution, saving you time each step of the way.
% (modulus) function (SQL Server)2nd 3rd % (wildcard) operator * character in SELECT statements + (concatenation) operator (SQL Server)2nd A only2nd 3rd 4th A or B but not both2nd 3rd Abstraction ADDDATE function (MySQL)2nd 3rd 4th adding headers to double pivoted result sets adding joins to existing joins ADD_MONTHS function (Oracle)2nd 3rd 4th 5th Aggregate functions aggregate functions and2nd aggregate functions versus aggregating groups/partitions simultaneously aggregating over moving value range2nd 3rd 4th Aliases ALL all rows/columns alphabetizing alphanumeric alphanumeric status2nd 3rd 4th 5th 6th alternatives to anti- any or "all" queries2nd 3rd 4th 5th 6th 7th Arithmetic AS keyword at least queries2nd 3rd 4th 5th 6th 7th at most queries2nd 3rd 4th 5th 6th averages without high/low values AVG function AVG function and axiom of abstraction2nd axiom of specification axiom schema of separation axiom schema of subsets bags Barber Puzzle Blocking business days between dates2nd 3rd 4th 5th 6th Business Logic by substrings by time units2nd 3rd 4th 5th calculating for all combinations calculating simple calendar2nd 3rd 4th 5th 6th 7th Calendars Cartesian products CAST function (SQL Server) CEIL function (DB2/MySQL/Oracle/PostgreSQL)2nd CEILING function (SQL Server)2nd changing row data characteristics of2nd 3rd 4th Characters COALESCE function2nd 3rd 4th 5th Columns columns in table columns with same data type comparing2nd 3rd 4th comparing records comparisons to2nd COMPLEX composite subqueries CONCAT function (MySQL)2nd 3rd concatenating Concatenation conditional logic in SELECT statements CONNECT BY clause2nd 3rd 4th CONNECT BY clause (Oracle) CONNECT_BY_ISLEAF function (Oracle)2nd CONNECT_BY_ROOT function (Oracle)2nd consecutive2nd consecutive numeric values Constraints constraints on table converting alphanumeric strings to converting to composite (Oracle)2nd 3rd converting whole to binary (Oracle) copying from another table correlated correlated subqueries COUNT function2nd 3rd 4th COUNT function and COUNT OVER window function2nd counting column values Counting rows CREATE TABLE command CREATE TABLE … LIKE command (DB2) creating (SQL Server) creating and copying definition cross-tab reports CSV output2nd 3rd CUBE extension2nd 3rd CURRENT_DATE function (DB2/MySQL/PostgreSQL)2nd 3rd data dependent keys Data dictionary data dictionary views (Oracle) DATE function (DB2) date ranges, identifying overlapping2nd 3rd 4th 5th DATE values in ORDER BY clause DATEADD function (MySQL) DATEADD function (SQL Server)2nd 3rd DATEDIFF function (MySQL/SQL Server)2nd 3rd 4th 5th DATENAME function (SQL Server)2nd 3rd 4th 5th DATEPART function (SQL Server)2nd 3rd 4th 5th Dates DATE_ADD function (MySQL)2nd 3rd 4th 5th DATE_FORMAT function (MySQL)2nd 3rd 4th 5th DATE_TRUNC function (PostgreSQL)2nd 3rd 4th 5th DAY function (DB2)2nd 3rd DAY function (MySQL)2nd 3rd 4th DAY function (SQL Server)2nd 3rd DAYNAME function (DB2/MySQL/SQL Server)2nd DAYOFWEEK function (DB2/MYSQL)2nd 3rd DAYOFYEAR function (DB2/MySQL/SQL Server)2nd 3rd 4th 5th DAYS function (DB2)2nd 3rd days in year DB2 DECODE function (Oracle)2nd Default keyword DEFAULT VALUES clause (PostgreSQL/SQL Server) defined defining rows to perform operation on2nd Delete command2nd deleting deleting records delimited data2nd delimited lists2nd 3rd 4th 5th 6th DENSE_RANK function (DB2/Oracle/SQL Server)2nd 3rd DENSE_RANK OVER window function (DB2/Oracle/SQL Server)2nd 3rd 4th difference between dates difference between record and next record2nd 3rd 4th differences between rows in group2nd 3rd 4th 5th distinct keyword DISTINCT keyword and duplicate duplicates duplicates and dynamic SQL equi-2nd equi-join operations2nd evaluation order exactly queries2nd 3rd 4th 5th 6th examples EXCEPT function2nd 3rd 4th EXTRACT function (PostgreSQL/MySQL)2nd extracting elements extreme values finding common rows finding non-matching text (Oracle)
fixed size groups for CASE expression for text not matching pattern (Oracle)2nd 3rd 4th forecasts foreign2nd 3rd foreign keys2nd 3rd 4th foreign keys without indexes FORMAT framing clause2nd 3rd 4th 5th 6th Frege Frege's axiom2nd GENERATE_SERIES function (PostgreSQL) generating SQL GETDATE function (SQL Server)2nd GROUP BY and2nd 3rd 4th GROUP BY clause2nd 3rd 4th 5th GROUP BY queries2nd 3rd 4th 5th 6th GROUPING grouping and2nd GROUPING function (DB2/Oracle/SQL Server)2nd 3rd 4th GROUPING function (MySQL/PostgreSQL) grouping rows by2nd 3rd 4th GROUPING SETS extension (DB2/Oracle)2nd 3rd groups and hierarchies highest/lowest values Histograms histograms, horizontal2nd Horizontal HOUR function (DB2) IF-ELSE operations in FROM clause in hierarchical structures2nd 3rd indexed columns in table Indexes information schema (MySQL/PostgreSQL/SQL Server) initials, extracting from name2nd 3rd 4th 5th inline views inline views and INNER inner joins2nd INSERT ALL statement (Oracle) INSERT FIRST statement (Oracle) INSERT statement2nd inserting data into2nd inserting records INSTR function (Oracle)2nd 3rd Integrity inter-row calculations INTERSECT operation2nd interval keyword2nd into multiple tables2nd 3rd IP Address parsing2nd 3rd IS NULL ITERATE command (Oracle) ITERATION_NUMBER function (Oracle) Join clause Joins joins and2nd joins when aggregates are used2nd 3rd 4th 5th KEEP clause2nd KEEP extension (Oracle)2nd 3rd Keys Knight values2nd 3rd Kyte LAG function (Oracle) LAG OVER window function (Oracle)2nd 3rd 4th 5th 6th 7th 8th LAST function (Oracle)2nd LAST_DAY function (MySQL/Oracle)2nd 3rd 4th 5th LEAD function (Oracle)2nd LEAD OVER window function LEAD OVER window function (Oracle) leap year2nd 3rd 4th 5th 6th 7th 8th LIKE operator LIMIT clause (MySQL/PostgreSQL)2nd 3rd listing Logarithms loop functionality LPAD function (Oracle/PostgreSQL/MySQL)2nd LTRIM function (Oracle) Manipulation max function2nd MAX OVER window function2nd 3rd MEASURES subclause of MODEL clause (Oracle) MEDIAN function (Oracle) MEDIAN/PERCENTILE_CONT functions2nd MERGE statement2nd merging records2nd Metadata min function MIN OVER window function (DB2/Oracle/SQL Server)2nd 3rd MIN/MAX functions and minimum values2nd 3rd 4th MINUS operation2nd 3rd MINUTE function (DB2) missing data from multiple tables2nd missing dates2nd 3rd 4th 5th 6th 7th 8th 9th Missing values2nd mixed alphanumeric data MOD function (DB2) MODEL clause2nd MODEL clause (Oracle) Modes modifying records modulus (%) function (SQL Server)2nd Month MONTH function (DB2/MySQL)2nd 3rd 4th MONTHNAME function (DB2/MySQL)2nd MONTHS_BETWEEN function (Oracle)2nd multiple rows2nd 3rd 4th 5th 6th multiple tables multiple tables and2nd Multisets Names2nd negation queries2nd 3rd NEW NEXT_DAY function (Oracle)2nd 3rd Node type2nd 3rd 4th 5th 6th 7th non-GROUP BY columns, returning2nd 3rd 4th 5th 6th non-subtotal rows nonmatching rows not A2nd 3rd 4th NOT EXISTS not in operator NROWS function (DB2/SQL Server) NTILE window function (Oracle/SQL Server)2nd 3rd NULL paradox2nd 3rd 4th NULL values NULL values and2nd 3rd nullable columns NULLs NULLs and NULLs in operations/comparisons numbers queries numeric content2nd 3rd 4th 5th 6th NVL function (Oracle) object types occurrences OFFSET clause (MySQL/PostgreSQL)2nd on data dependent key on multiple fields on single field one row operator (+) (SQL Server)2nd operator (||) (DB2/Oracle/PostgreSQL)2nd Optimizing Transact-SQL: Advanced Programming Techniques (Rozenshtein et al.) OR logic in2nd 3rd OR operations and Oracle Oracle support for