Primary use of MySQL

Source: Internet
Author: User

One: Simple use of MySQL

1. Today to record common SQL commands

View Gallery show databases;

view table show tables;

Enter library use library name;

Create a new library create database name;

Create a new table the CREATE table library name. Table Name (field type (width) constraint); (You can omit the library name when in the library)

eg

 

1 start creating the first table DB1, and view the table structure

2 Insert the first value into the table and use the command to view

3 Append a field in the DB1 table

4 Modifying the value of age

SQL statement used:

Modify table structure: Alter tables library. Table Execution Action

Execution actions include:

{add: Add, modify field type and constraint: Modify, modify field name: Change, modify table name: Rename, delete: Drop}

ALTER TABLE Add|modify|change|rename

ALTER TABLE DB1 add age int (2); [Firsh|after: Specify where to insert]

ALTER TABLE DB1 Modify field Name type (width) constraint;

ALTER TABLE DB1 change original field name New name type (immutable) constraint (variable);

ALTER TABLE DB1 Rename the name of the new table with the original table name;

ALTER TABLE DB1 drop field

Primary use of MySQL

Related Article

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.