MySQL Study first day

Source: Internet
Author: User

MySQL statement syntax

I. Database definition statements (DDL)

1. ALTER DATABASE syntax

Alter database is used to change the global nature of the databases, which are stored in the db.opt file in the database directory. To use ALTER DATABASE, you need to have the ALTER permission

   Character Set clause to change the default data character set .

   Collate clause to change the default database collation

The database name can be ignored, at which point the statement corresponds to the default database, or you can use the alter schema

  

Database operations:

1. Display data

  

2. Select Database

  

3. Create the database and set the encoding to UTF-8

  

4. Modify the database character set to UTF8

  

5\, deleting a database

  

6. View database Status

  

 2. ALTER TABLE syntax

  Syntax users change the structure of an existing table, for example, you can add or subtract columns, create or cancel an index, change the type of an existing column, or rename a column or table. You can also change the table's commentary and table type

Among the allowed changes, the syntax of many clauses is similar to that of the clauses in CREATE TABLE, including table_options modifications, Options Engien, Auto_increment, Avg_row_length, and so on.

Some operations are not supported by the storage engine and a warning occurs if these operations are performed. These warnings can be displayed using show warnings.

  

  1. Displaying database tables

  

MySQL Study first day

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.