MySQL Database concepts and introductory statements

Source: Internet
Author: User

The concept of a database

Database ( DATABASE,DB) is an organized, shared, and centrally managed collection of data that is stored in a computer for a long time. She is a computer software system that stores and manages data in accordance with the information structure. The concept of the database actually includes two layers of meaning: (1) The database is an entity, it is a "warehouse" that can reasonably keep the data, the user stores the transaction data to be managed in the "warehouse", the "Data" and "library" two concepts are combined into a database. (2) database is a new method and technology of data management, he can better organize data, more convenient maintenance data, tighter control data and more efficient utilization of data.

MySQL Entry statement

Operation of the database

Display Database

Show databases;

The effect is as follows:

Create a database

Create  database name;

Use a database

 use database name;

Deleting a database

Drop  database name;   Drop Fall

Operation of the table

Displaying tables in a database

Show tables;          Enter the database first

Create a table

Create a table Create Table Table name (  Field 1 field type, Field 2 field type  ,  field 3 field type)--------Createtable Class (  int,  varchar),   int );

View a table structure

Desc table name;

Renaming a table

Table  to NewName;

Delete a table

Drop  table name;

Operation of the field

Add Field

Alter Table Add field name fields type  

Modify field names

Alter  table name change old field name new field name fields type

modifying field types

Alter  Table Table name modify   (decorated)  field name fields type

Delete a field

Alter Table Drop Field name

Modify field arrangement position

Command:

ALTER TABLE | After field name 2

Example 1:

ALTER TABLE VARCHAR (a) first;                  (insert field sname to the first position of the table)

Example 2:

ALTER TABLE INT (one) after sname;                    (Insert field sno after field sname)

MySQL Database concepts and introductory statements

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.