Beginning MySQL, Sheldon R., Moes G.

Beginning MySQL - Robert Sheldon, Geoff Moes - 2005.

   Welcome to Beginning MySQL, the definitive resource for anyone new to the MySQL database management system. As the most popular open source database system in the world, MySQL has gained not only recognition among its peers but a place of prominence in the worldwide technical industry, ensuring an ever-growing need for information and training on how to implement a MySQL database and access and manage data in that database.

Beginning MySQL



Contents
Acknowledgments v
Introduction xxv
Chapter 1: Introducing the MySQL Relational Database Management System 1
Databases and Database Management Systems 2
What Is a Database? 2
The Hierarchical Model 3
The Network Model 5
The Relational Model 6
Database Management Systems 7
The MySQL RDBMS 8
The Open-Source Movement 9
The SQL Framework 9
What is SQL? 10
A Brief History of SQL 11
The Nonprocedural Nature of SQL 14
SQL Statements 14
Types of Execution 26
Implementation-Specific SQL 31
Data-Driven Applications 32
The Application Server 32
Connecting to a MySQL Database 33
Creating a Data-Driven Application 35
Summary 40
Exercises 42
Chapter 2: Installing MySQL 43
Getting Started 43
Making the Preliminary Decisions 44
Selecting a Version of MySQL 44
Selecting a Platform to Run MySQL 44
Selecting a MySQL Distribution Type 45
Selecting an Edition of MySQL 46
Downloading Distribution Files 46
TEAM LinG - Live, Informative, Non-cost and Genuine !
Installing MySQL 48
Using RPM Files to Install MySQL on Linux 49
Using a Tar File to Install MySQL on Linux 51
Creating the User and Group Accounts 51
Copying the Tar File 52
Unpacking the Distribution File 53
Initializing the Installation 54
Starting the MySQL Server 55
Installing MySQL on Windows 57
Running the Installation Program 57
Configuring the MySQL Server 61
Editions of the MySQL Server 64
Testing Your MySQL Installation 65
Verifying Your Linux Installation 65
Verifying Your Windows Installation 68
Summary 70
Exercises 71
Chapter 3: Working with MySQL 73
Understanding the MySQL Directory Structure 73
MySQL File Storage 74
File Storage for a Linux RPM Installation 74
File Storage for a Linux Tar Installation 75
File Storage for a Windows Installation 76
The Data Directory 77
The mysql Database 78
The Grant Tables 79
Using the MySQL Programs 83
Specifying Program Options 83
Specifying Options at a Command Prompt 83
Specifying Options in a Configuration File 85
Server-Related Programs, Scripts, and Library Files 88
Client Programs 89
The mysql Utility 90
Using mysql in Interactive Mode 90
Using mysql in Batch Mode 97
Assigning Account Passwords 100
Setting Up a Configuration File 103
Summary 106
Exercises 107
TEAM LinG - Live, Informative, Non-cost and Genuine !
Chapter 4: Designing a Relational Database 109
The Relational Model 109
Data Normalization 111
First Normal Form 111
Second Normal Form 113
Third Normal Form 115
Relationships 116
One-to-One Relationships 117
One-to-Many Relationships 117
Many-to-Many Relationships 119
Creating a Data Model 119
Identifying Entities 122
Normalizing Data 124
Identifying Relationships 125
Refining the Data Model 126
Designing the DVDRentals Database 127
Summary 136
Exercises 137
Chapter 5: Managing Databases, Tables, and Indexes 139
Managing Databases 139
Creating Databases 140
Modifying Databases 142
Deleting Databases 142
Managing Tables 142
Creating Tables 143
Creating Column Definitions 144
Defining a Column’s Nullability 152
Defining Default Values 153
Defining Primary Keys 154
Defining Auto-Increment Columns 155
Defining Foreign Keys 156
Defining Table Types 158
Creating Tables in the DVDRentals Database 160
Modifying Tables 167
Deleting Tables 169
Managing Indexes 171
Index Types 171
Creating Indexes 172
Defining Indexes When Creating Tables 172
Adding Indexes to Existing Tables 175
Removing Indexes 179
TEAM LinG - Live, Informative, Non-cost and Genuine !
Retrieving Information About Database Objects 179
Using SHOW Statements 180
Using Database-Related SHOW Statements 180
Using Table-Related SHOW Statements 181
Using DESCRIBE Statements 183
Summary 187
Exercises 188
Chapter 6: Manipulating Data in a MySQL Database 189
Inserting Data in a MySQL Database 189
Using an INSERT Statement to Add Data 190
Using the <values option> Alternative of the INSERT Statement 191
Using the <values option> Alternative to Insert Data in the DVDRentals Database 195
Using the <set option> Alternative of the INSERT Statement 203
Using a REPLACE Statement to Add Data 205
Using the <values option> Alternative of the REPLACE Statement 206
Using the <set option> Alternative of the REPLACE Statement 208
Updating Data in a MySQL Database 210
Using an UPDATE Statement to Update a Single Table 211
Using an UPDATE Statement to Update Joined Tables 216
Deleting Data from a MySQL Database 219
Using a DELETE Statement to Delete Data 219
Deleting Data from a Single Table 220
Deleting Data from Joined Tables 222
Using a TRUNCATE Statement to Delete Data 226
Summary 227
Exercises 227
Chapter 7: Retrieving Data from a MySQL Database 229
The SELECT Statement 230
Using Expressions in a SELECT Statement 238
Using Variables in a SELECT Statement 241
Using a SELECT Statement to Display Values 243
The SELECT Statement Options 245
The Optional Clauses of a SELECT Statement 249
The WHERE Clause 250
The GROUP BY Clause 254
The HAVING Clause 259
The ORDER BY Clause 261
The LIMIT Clause 265
Summary 267
Exercises 268
TEAM LinG - Live, Informative, Non-cost and Genuine !
Chapter 8: Using Operators in Your SQL Statements 269
Creating MySQL Expressions 269
Operator Precedence 270
Grouping Operators 271
Using Operators in Expressions 272
Arithmetic Operators 272
Comparison Operators 277
Logical Operators 291
Bitwise Operators 296
Sort Operators 302
Summary 306
Exercises 306
Chapter 9: Using Functions in Your SQL Statements 309
Comparing and Converting Data 310
Comparison Functions 310
GREATEST() and LEAST() Functions 310
COALESCE() and ISNULL() Functions 311
INTERVAL() and STRCMP() Functions 312
Control Flow Functions 314
IF() Function 314
IFNULL() and NULLIF() Functions 315
CASE() Function 316
Cast Functions 320
Managing Different Types of Data 322
String Functions 323
ASCII() and ORD() Functions 323
CHAR_LENGTH(), CHARACTER_LENGTH(), and LENGTH() Functions 323
CHARSET() and COLLATION() Functions 324
CONCAT() and CONCAT_WS() Functions 325
INSTR() and LOCATE() Functions 325
LCASE(), LOWER(), UCASE(), and UPPER() Functions 326
LEFT() and RIGHT() Functions 327
REPEAT() and REVERSE() Functions 327
SUBSTRING() Function 328
Numeric Functions 333
CEIL(), CEILING(), and FLOOR() Functions 333
COT() Functions 333
MOD() Function 334
PI() Function 334
POW() and POWER() Functions 334
ROUND() and TRUNCATE() Functions 334
SQRT() Function 335
TEAM LinG - Live, Informative, Non-cost and Genuine !
Date/Time Functions 339
ADDDATE(), DATE_ADD(), SUBDATE(), DATE_SUB(), and EXTRACT() Functions 339
CURDATE(), CURRENT_DATE(), CURTIME(), CURRENT_TIME(), CURRENT_TIMESTAMP(),
and NOW() Functions 341
DATE(), MONTH(), MONTHNAME(), and YEAR() Functions 342
DATEDIFF() and TIMEDIFF() Functions 344
DAY(), DAYOFMONTH(), DAYNAME(), DAYOFWEEK(), and DAYOFYEAR() Functions 344
SECOND(), MINUTE(), HOUR(), and TIME() Functions 345
Summarizing Data 349
Summary Functions 350
AVG() Function 350
SUM() Function 351
MIN() and MAX() Functions 352
COUNT() Function 353
Bit Functions 354
Performing System Operations 358
Encryption Functions 358
ENCODE() and DECODE() Functions 358
PASSWORD(), MD5(), SHA(), and SHA1() Functions 359
System-Related Functions 361
CURRENT_USER(), SESSION_USER(), SYSTEM_USER(), and USER() Functions 361
CONNECTION_ID(), DATABASE(), and VERSION() Functions 361
INET_ATON() and INET_NTOA() Functions 362
Query and Insert Functions 362
FOUND_ROWS() Function 362
LAST_INSERT_ID() Function 363
Summary 366
Exercises 366
Chapter 10: Accessing Data in Multiple Tables 369
Creating Joins in Your SQL Statements 369
Joining Tables in a SELECT Statement 370
Creating Full Joins 373
Creating Outer Joins 385
Creating Natural Joins 391
Joining Tables in an UPDATE Statement 393
Joining Tables in a DELETE Statement 394
Creating Subqueries in Your SQL Statements 396
Adding Subqueries to Your SELECT Statements 396
Working with Comparison Operators 396
Working with Subquery Operators 399
Working with Grouped Data 403
TEAM LinG - Live, Informative, Non-cost and Genuine !
Adding Subqueries to Your UPDATE Statements 410
Adding Subqueries to Your DELETE Statements 411
Creating Unions That Join SELECT Statements 414
Summary 417
Exercises 418
Chapter 11: Exporting, Copying, and Importing Data 421
Exporting Data Out of a Table 421
Exporting Data to an Out File 423
Exporting Data to a Dump File 430
Copying Data into a Table 431
Copying Data into a New Table 432
Copying Data into an Existing Table 435
Using the INSERT Statement to Copy Data 435
Using the REPLACE Statement to Copy Data 436
Importing Data into a Table 438
Using the mysql Utility to Import Data 438
Using the LOAD DATA Statement to Import Data 438
Using the source Command to Import Data 444
Using the mysql Command to Import Data 446
Using the mysqlimport Utility to Import Data 449
Summary 452
Exercises 453
Chapter 12: Managing Transactions 455
Introducing Transactions 455
Performing a Transaction 457
Performing a Basic Transaction 457
The START TRANSACTION Statement 458
The COMMIT Statement 458
The ROLLBACK Statement 459
Statements That Automatically Commit Transactions 460
Adding Savepoints to Your Transaction 463
The SAVEPOINT Statement 464
The ROLLBACK TO SAVEPOINT Statement 465
Setting the Autocommit Mode and Transaction Isolation Level 468
Setting the Autocommit Mode 468
Setting the Transaction Isolation Level 472
Data Anomalies in a Transaction 472
Transaction Isolation Levels 475
Using the SET TRANSACTION Statement 476
TEAM LinG - Live, Informative, Non-cost and Genuine !
Locking Nontransactional Tables 479
The LOCK TABLES Statement 480
The UNLOCK TABLES Statement 480
Summary 483
Exercises 483
Chapter 13: Administering MySQL 485
Performing Administrative Tasks 485
Managing System Variables 494
Retrieving System Variable Settings 495
Using the SHOW VARIABLES Statement to Retrieve Server System Variable Settings 495
Using the SELECT Statement to Retrieve Dynamic System Variable Settings 497
Using the SHOW STATUS Statement to Retrieve Server Status Variable Settings 498
Modifying the Server Configuration 502
Specifying System Settings at the Command Line 502
Specifying System Settings in an Option File 503
Specifying System Settings at Runtime 503
Managing Log Files 506
Working with Error Log Files 506
Enabling Query and Binary Logging 507
Setting Up Query Logging 507
Setting Up Binary Logging 507
Summary 515
Exercises 516
Chapter 14: Managing MySQL Security 517
The Access Privilege System 517
MySQL Grant Tables 518
The user Table 518
The db Table 520
The host Table 521
The tables_priv Table 522
The columns_priv Table 523
MySQL Privileges 524
MySQL Access Control 527
Authenticating Connections 527
Verifying Privileges 529
Managing MySQL User Accounts 533
Adding Users and Granting Privileges 533
Using the GRANT Statement 533
Using the SHOW GRANTS Statement 545
TEAM LinG - Live, Informative, Non-cost and Genuine !
Setting Passwords for MySQL User Accounts 551
Using the SET PASSWORD Statement 551
Using the FLUSH PRIVILEGES Statement 551
Dropping Users and Revoking Privileges 553
Using the REVOKE Statement 553
Using the DROP USER Statement 555
Summary 558
Exercises 559
Chapter 15: Optimizing Performance 561
Optimizing MySQL Indexing 561
Optimizing SQL Queries 565
Optimizing Data Retrieval 566
Using the EXPLAIN Statement 566
Using the OPTIMIZE TABLE Statement 571
Understanding the SELECT Statement Guidelines 573
Optimizing Data Insertion 577
Optimizing Data Modification and Deletion 578
Optimizing MySQL Tables 579
Optimizing Your System’s Cache 580
Summary 584
Exercises 584
Chapter 16: Managing Backup, Recovery, and Replication 587
Backing Up Your Database 588
Backing Up a Single Database 588
Backing Up the Entire Database 588
Backing Up Individual Tables 594
Backing Up Multiple Databases 594
Backing Up Specific Databases 595
Backing Up All Databases 595
Restoring Your Database 599
Reloading Your Database 600
Using the mysql Client Utility in Batch Mode to Reload Your Database 600
Using the mysql Client Utility in Interactive Mode to Reload Your Database 600
Updating the Restored Database from Binary Log Files 601
Restoring Data Directly from a Binary Log 601
Restoring Binary Log Data from a Text File 602
Enabling and Disabling Binary Logging 603
Replicating Your Database 606
Implementing Replication 608
TEAM LinG - Live, Informative, Non-cost and Genuine !
Managing Replication 610
Managing the Master Server 611
Managing the Slave Server 612
Summary 615
Exercises 616
Chapter 17: Connecting to MySQL from a PHP Application 617
Introduction to PHP 618
Building a Data-Driven PHP Application 619
Connecting to a MySQL Database 619
Retrieving Data from a MySQL Database 621
Processing the Result Set 622
Manipulating Data in PHP 623
Converting Date Values 625
Working with HTML Forms 626
Redirecting Browsers 627
Working with Include Files 627
Creating a Basic PHP Application 628
Inserting and Updating Data in a MySQL Database 639
Adding Insert and Update Functionality to Your Application 640
Deleting Data from a MySQL Database 660
Summary 664
Exercises 665
Chapter 18: Connecting to MySQL from a Java/J2EE Application 667
Introduction to Java/J2EE 667
Building a Java/J2EE Web Application 669
Importing Java Classes 669
Declaring and Initializing Variables 670
Connecting to a MySQL Database 671
Retrieving Data from a MySQL Database 672
Processing the Result Set 673
Manipulating String Data 674
Converting Values 675
Working with HTML Forms 677
Redirecting Browsers 678
Including JSP Files 678
Managing Exceptions 679
Creating a Basic Java/J2EE Web Application 679
Inserting and Updating Data in a MySQL Database 692
Adding Insert and Update Functionality to Your Application 693
Deleting Data from a MySQL Database 716
TEAM LinG - Live, Informative, Non-cost and Genuine !
Summary 721
Exercises 721
Chapter 19: Connecting to MySQL from an ASP.NET/C# Application 723
Introduction to ASP.NET/C# 724
Building an ASP.NET/C# Application 725
Setting up the ASP.NET Web Page 725
Declaring and Initializing Variables 725
Connecting to a MySQL Database 727
Retrieving Data from a MySQL Database 728
Processing the Result Set 729
Manipulating String Data 730
Converting Values 731
Working with HTML Forms 732
Redirecting Browsers 733
Including ASP.NET Files 733
Managing Exceptions 734
Creating a Basic ASP.NET/C# Application 735
Inserting and Updating Data in a MySQL Database 748
Adding Insert and Update Functionality to Your Application 750
Deleting Data from a MySQL Database 773
Summary 777
Exercises 778
Appendix A: Exercise Answers 781
Chapter 1 781
Exercises Solutions 781
Chapter 2 782
Exercises Solutions 782
Chapter 3 782
Exercises Solutions 782
Chapter 4 783
Exercises Solutions 783
Chapter 5 784
Exercises Solutions 784
Chapter 6 785
Exercises Solutions 785
Chapter 7 786
Exercises Solutions 786
Chapter 8 787
Exercises Solutions 787
TEAM LinG - Live, Informative, Non-cost and Genuine !
Chapter 9 788
Exercises Solutions 788
Chapter 10 789
Exercises Solutions 789
Chapter 11 790
Exercises Solutions 790
Chapter 12 791
Exercises Solutions 791
Chapter 13 792
Exercises Solutions 792
Chapter 14 793
Exercises Solutions 793
Chapter 15 794
Exercises Solutions 794
Chapter 16 795
Exercises Solutions 795
Chapter 17 797
Exercises Solutions 797
Chapter 18 798
Exercises Solutions 798
Chapter 19 799
Exercises Solutions 799
Appendix B: MySQL APIs 801
Appendix C: MySQL 5 805
Stored Procedures 806
Triggers 807
Views 808
Index 811



Бесплатно скачать электронную книгу в удобном формате, смотреть и читать:
Скачать книгу Beginning MySQL, Sheldon R., Moes G. - fileskachat.com, быстрое и бесплатное скачивание.

Скачать pdf
Ниже можно купить эту книгу по лучшей цене со скидкой с доставкой по всей России.Купить эту книгу



Скачать книгу  Beginning MySQL - Robert Sheldon, Geoff Moes - depositfiles

Скачать книгу  Beginning MySQL - Robert Sheldon, Geoff Moes - rapidshare
Дата публикации:





Хештеги: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::