MySQL 5.5 Command Line Client SQL common statements

Source: Internet
Author: User

MySQL 5.5 Command Line Client SQL common statements

A. create databases and data tables
Root Login MySQL
Create a database named demo
Create schema demo;

USE the USE command to specify the demo Database
USE demo;

Create a t_message table with fields such as id, name, email, and msg.
Create table t_message (
Id int not null AUTO_INCREMENT primary key,
Name CHAR (20) not null,
Email CHAR (40 ),
Msg TEXT NOT NULL
);
Set the id to AUTO_INCREMENT, indicating that MySQL manages the value of a field. If no id value is specified, it will automatically increase according to the id value of the previous data; specify the primary key. You can specify fields to set the primary key. You can also set the primary key as follows:
Create table t_message (
Id int not null AUTO_INCREMENT,
Name CHAR (20) not null,
Email CHAR (40 ),
Msg text not null,
Primary key (id)
);


Delete A data table
Drop table t_message;


Delete the entire database
Drop schema demo;

For more details, please continue to read the highlights on the next page:
 

Recommended reading:

MySQL 5.5 Command Line Client cannot be opened (disappears in a flash) Solution

Load Nginx in Ubuntu for high-performance WEB Server 5 --- MySQL master/Master Synchronization

Production Environment MySQL master/Master synchronization primary key conflict handling

MySQL Master/Slave failure error Got fatal error 1236

MySQL master-slave replication, implemented on a single server

Compile and install MySQL dual-instance in Ubuntu and configure master-slave Replication

  • 1
  • 2
  • Next Page

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.