Example: stock market

MySQL Tutorial

MySQL TutorialAbstractThis is the MySQL Tutorial from the MySQL Reference legal information, see the Legal help with using MySQL , please visit the MySQL Forums, where you can discuss your issues with otherMySQL generated on: 2022-08-23 (revision: 73994)Table of ContentsPreface and Legal v1 12 Connecting to and Disconnecting from the 33 Entering 54 Creating and Using a Creating and Selecting a Creating a Loading Data into a Retrieving Information from a Selecting All Selecting Particular Selecting Particular Sorting Date Working with NULL Pattern Counting Using More Than one 245 Getting Information About Databases and 276 Using MySQL in Batch 297 Examples of Common The Maximum Value for a The Row Holding the Maximum of a Certain Maximum of Column per The Rows Holding the Group-wise Maximum of a Certain Using User-Defined Using Foreign Searching on Two Calculating Visits Per Using 368 Using

operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract.

Tags:

  Programs, Oracle, Mysql

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of MySQL Tutorial

1 MySQL TutorialAbstractThis is the MySQL Tutorial from the MySQL Reference legal information, see the Legal help with using MySQL , please visit the MySQL Forums, where you can discuss your issues with otherMySQL generated on: 2022-08-23 (revision: 73994)Table of ContentsPreface and Legal v1 12 Connecting to and Disconnecting from the 33 Entering 54 Creating and Using a Creating and Selecting a Creating a Loading Data into a Retrieving Information from a Selecting All Selecting Particular Selecting Particular Sorting Date Working with NULL Pattern Counting Using More Than one 245 Getting Information About Databases and 276 Using MySQL in Batch 297 Examples of Common The Maximum Value for a The Row Holding the Maximum of a Certain Maximum of Column per The Rows Holding the Group-wise Maximum of a Certain Using User-Defined Using Foreign Searching on Two Calculating Visits Per Using 368 Using

2 MySQL with 41iiiivPreface and Legal NoticesThis is the MySQL Tutorial from the MySQL Reference information MySQL This product may include third-party software, used underlicense. If you are using a Commercial release of MySQL , see the MySQL Commercial ReleaseLicense Information User Manual for licensing information, including licensing information relating tothird-party software that may be included in this Commercial release. If you are using a Communityrelease of MySQL , see the MySQL Community Release License Information User Manualfor licensing information, including licensing information relating to third-party software that may beincluded in this Community NoticesCopyright 1997, 2022, oracle and/or its software and related documentation are provided under a license agreement containingrestrictions on use and disclosure and are protected by intellectual property laws.

3 Except as expresslypermitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate,broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in anyform, or by any means. Reverse engineering, disassembly, or decompilation of this software, unlessrequired by law for interoperability, is information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in this is software or related documentation that is delivered to the Government or anyonelicensing it on behalf of the Government, then the following notice is GOVERNMENT END USERS: oracle programs (including any operating system, integratedsoftware, any programs embedded, installed or activated on delivered hardware, and modifications ofsuch programs ) and oracle computer documentation or other oracle data delivered to or accessed Government end users are "commercial computer software" or "commercial computer softwaredocumentation" pursuant to the applicable Federal Acquisition Regulation and agency-specificsupplemental regulations.

4 As such, the use, reproduction, duplication, release, display, disclosure,modification, preparation of derivative works, and/or adaptation of i) oracle programs (including anyoperating system, integrated software, any programs embedded, installed or activated on deliveredhardware, and modifications of such programs ), ii) oracle computer documentation and/or iii) otherOracle data, is subject to the rights and limitations specified in the license contained in the applicablecontract. The terms governing the Government's use of oracle cloud services are defined by theapplicable contract for such services. No other rights are granted to the software or hardware is developed for general use in a variety of information managementapplications. It is not developed or intended for use in any inherently dangerous applications, includingapplications that may create a risk of personal injury.

5 If you use this software or hardware in dangerousapplications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, andother measures to ensure its safe use. oracle Corporation and its affiliates disclaim any liability for anydamages caused by use of this software or hardware in dangerous and Java are registered trademarks of oracle and/or its affiliates. Other names may betrademarks of their respective and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARCI nternational, Inc. AMD, Epyc, and the AMD logo are trademarks or registered trademarks of AdvancedMicro Devices. UNIX is a registered trademark of The Open software or hardware and documentation may provide access to or information about content,products, and services from third parties.

6 oracle Corporation and its affiliates are not responsiblevDocumentation Accessibilityfor and expressly disclaim all warranties of any kind with respect to third-party content, products,and services unless otherwise set forth in an applicable agreement between you and oracle . OracleCorporation and its affiliates will not be responsible for any loss, costs, or damages incurred due toyour access to or use of third-party content, products, or services, except as set forth in an applicableagreement between you and documentation is NOT distributed under a GPL license. Use of this documentation is subject to thefollowing terms:You may create a printed copy of this documentation solely for your own personal use. Conversionto other formats is allowed as long as the actual content is not altered or edited in any way. You shallnot publish or distribute this documentation in any form or on any media, except if you distribute thedocumentation in a manner similar to how oracle disseminates it (that is, electronically for downloadon a Web site with the software) or on a CD-ROM or similar medium, provided however that thedocumentation is disseminated together with the software on the same medium.

7 Any other use, suchas any dissemination of printed copies or use of this documentation, in whole or in part, in anotherpublication, requires the prior written consent from an authorized representative of oracle . oracle and/or its affiliates reserve any and all rights to this documentation not expressly granted AccessibilityFor information about oracle 's commitment to accessibility, visit the oracle Accessibility Programwebsite to oracle Support for AccessibilityOracle customers that have purchased support have access to electronic support through My OracleSupport. For information, # 1 TutorialThis chapter provides a Tutorial introduction to MySQL by showing how to use the MySQL clientprogram to create and use a simple database. MySQL (sometimes referred to as the terminal monitor or just monitor ) is an interactive program that enables you to connect to a MySQL server, runqueries, and view the results.

8 MySQL may also be used in batch mode: you place your queries in a filebeforehand, then tell MySQL to execute the contents of the file. Both ways of using MySQL are see a list of options provided by MySQL , invoke it with the --help option:$> MySQL --helpThis chapter assumes that MySQL is installed on your machine and that a MySQL server is availableto which you can connect. If this is not true, contact your MySQL administrator. (If you are theadministrator, you need to consult the relevant portions of this manual, such as MySQL ServerAdministration.)This chapter describes the entire process of setting up and using a database. If you are interested onlyin accessing an existing database, you may want to skip the sections that describe how to create thedatabase and the tables it this chapter is Tutorial in nature, many details are necessarily omitted.

9 Consult the relevantsections of the manual for more information on the topics covered 2 Connecting to and Disconnecting from the ServerTo connect to the server, you usually need to provide a MySQL user name when you invoke mysqland, most likely, a password. If the server runs on a machine other than the one where you log in, youmust also specify a host name. Contact your administrator to find out what connection parameters youshould use to connect (that is, what host, user name, and password to use). Once you know the properparameters, you should be able to connect like this:$> MySQL -h host -u user -pEnter password: **host and user represent the host name where your MySQL server is running and the user name ofyour MySQL account. Substitute appropriate values for your setup. The ** represents yourpassword; enter it when MySQL displays the Enter password: that works, you should see some introductory information followed by a MySQL > prompt:$> MySQL -h host -u user -pEnter password: **Welcome to the MySQL monitor.

10 Commands end with ; or \ MySQL connection id is 25338 to server version: 'help;' or '\h' for help. Type '\c' to clear the >The MySQL > prompt tells you that MySQL is ready for you to enter SQL you are logging in on the same machine that MySQL is running on, you can omit the host, and simplyuse the following:$> MySQL -u user -pIf, when you attempt to log in, you get an error message such as ERROR 2002 (HY000): Can'tconnect to local MySQL server through socket '/ ' (2), it meansthat the MySQL server daemon (Unix) or service (Windows) is not running. Consult the administrator orsee the section of Installing and Upgrading MySQL that is appropriate to your operating help with other problems often encountered when trying to log in, see Common Errors When UsingMySQL MySQL installations permit users to connect as the anonymous (unnamed) user to the serverrunning on the local host.


Related search queries