MySQL Data manipulation

Source: Internet
Author: User

One, MySQL 's software architecture

A) turn on MySQL server: Open in the form of Windows service, under cmd net start mysql|net Stop MySQL, use mysqld –default-file= "D:/amp/mysql/my.ini" under cmd

b) connect to MySQL server

c) MySQL command, help, the instructions can all use the \ Letter to complete

d) MySQL comment: line comment:# or -- , block comment is / * * /

Second, the operation of the database

A) creating database:Create library name [ library option ];

b) View database:show databases; Show CREATE DATABASE name ;

c) Delete database: Drop databases[if exists] library name

d) Modify the database: Only library options can be modified;Alter library name new library options

Third, data table Operation

A) Select the database: Explicit selection, with the name of the name in front of the table, the implicit choice,use the name of the library ;

b) Create a data table:The CREATE table table name (field list)[ table Options ];

c) View data sheet:show tables; Show CREATE table table name ; describe|desc table name ;

d) Modify the data sheet:

  1. Modify table name: alter tables table name rename to new table name; rename table old table name to new table name
  2. modify column definition:
    1. add a column: ALTER TABLE Span style= "font-family: Arial" > table name add new field type name;
    2. Delete a column: ALTER TABLE table name drop field name;
    3. modify field type: ALTER TABLE modify Field name new field type
    4. modify field sort: ALTER TABLE modify field name 1 new field type

First|after field name 2

    1. Rename field:ALTER TABLE name change old field name new field name new field type
    2. Modify Table options:ALTER TABLE table name new tables option (default charset GBK engine Myisam)

Four, data manipulation

A) Insert data:INSERT into table name (field list) values(Value list)

b) View data:Select *| Field List from Table name [where query condition ]

c) Delete data:delete from table name [where delete condition ]

d) Modify data:update table name set field 1= New value 1, field 2 = New Value 2 ... [where Modify condition ]

MySQL Data manipulation

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.