作者:empty 页数:205 出版社:empty |
Nu shel Handbook, the NurshelHandbaoklogu, and the OR elly b go areregistered trademarks of O'Relly Meda, In e.The Picker Gwu de series dest gMany of the des ag nations used by manufacturers and sllerstodsnguishde ag nations have been pnn ted in caps or inital capsdamages resul ig from the use of the infomat on contained here n
IntroductionThis book is an attempt to cram the most useful informationabour SQL into a pocket-size guide.It covers commonly usedsyutaxfortheolowngptorms:IBMDB2Relase 97MySQL 5.1, Oracle Dara basel lg Rel case 2.PostgresQL 9.0and Microsoft SQLServer 2008 Release 2.Noe all syntax will work on all platforms, and some featuresmay not be available in earlier releases of these productsWhenever possable, Pve tried to note any product or releasedepend eric iesOrganization of This BookTo pies are organized alphabetically, with many section namescarefully chosen to correspond to relevant SQL keywords.Forexample, see“Inserting Data on page 67 for help with theINSERT statement.Platform notesMySQL requires the leading parenthesis in a function invocation to immediately follow the function name.For examplepr(name) wllgancateneTtrmssagehec use of i hespace between upper and(nane) .
All example SQL statements in this book execute a ganstaset of tables and data that you can download from this book'scatalogpageathttp://oreilly.com/catalog/97814493940977.Figure li lust rates the relationships between the core tables,which give information on waterfalls in Michigan'sUpper Peninsula.5ome examples also use tables based on order ved fromThe terms datum, zone, northing, and easting refer to UniversalTransverse Mercator(UTM) grid coordinates, such as thoseyou might use with a topographical map or GPS device.Formore,sechttp:lergusgs-gouhsblpubs/factsheets/fs07701.htmlSome 5QL examples in this book use a pivottable, which isnothing more than a single-column table containing sequen-tially wum be red rows in this case, 1, 000rows.The name ofthe table is pivot, (Exceptions!In SQLServer, pivot is are-served word, so the SQLServer example script creates the tableasp iv vot, with two vs.In the MySQL script, the table dual isThis book is here to help you get your job done.In general, youmay use the code in this book in your programs and docu-mentation.You do not need to contact us for permission unlessyou're reproducing a significant portion of the code.Forex-ample, wnit in ga progra tn that uses several chunks of code fromthis book does not require perms sion.Selling or distributinga CD-ROM of examples from OReilly books does require per-miss ton.Answering a question by citing this book and quotingexample code does not require permis st on.In e or po rating asignificant amount of example code from this book into yourWe appreciate, but do not require, attribution.An attributionusually includes the title, author, publisher, and ISBN.Forexample:“SQL Pocket Guide, by Jonathan Gen nick(O'Reilly) .Denotes an optional element of syntax
SQL Pcket Gul de
Intrductin
Analytic Functins
CASE Expressins:Simple
CASE Expressins:Searched
CAST Functin
CNNECT BY Queries
Data I ype Cnversin
DataTypes:Binary Integer
DataTypes:Character String
DataTypes:Date t me
DataTypes:Decimal
Datetime Cnversins:DB 2
Datetime Cnversins:MySQL
Datetime Cnversins:r a de
Date t me Cnversins:PstgreSQL
Datetime Cnversins:5QL Server
Datetime Funcin s:DB 2
Date t me Functins:My5QL
Datetime Functins:r a de
Date t me Functins:PstgreSQL
Datetime Functins:SQLServer
Sec r id Editin
Third Edit n
Deleting Data
EXTRACT Functin
GREATEST
Gruping and Sum man zing
Hierarchical Queries
Indexes, Crea ing
Indexes, Remving
Inserting Data
Jining Tables
LEAST
Literals
Merging Data
Nulls
Numeric Cnversins:DB 2
Numeric Cnversins:MySQL
Numeric Cnversins:r a de
Numeric Cnversins:Pst gre5QL
Numeric Cnversins:SQLServer
Numeric/Math Functins
0LAP Functins
Pi ting and Un pivting
Predicates
Recursive Queries
Regular Expressins
Selecting Data
String Funct