Getting Started with MySQL basics

Source: Internet
Author: User

Basic command: (SQL semicolon end, remember, remember)

Login mysql:mysql-h ip-u User name-p or mysql-u user name-p password

View database: show databases;//Many databases, so databases

(where Information_schema/mysql/perfornance_schema data cannot be modified, the system comes with it)

Select a database: Use library name;

View table: Show tables;//Many tables, so tables

Delete Library: drop database name;

Creating Table: Create TABLE Class (Stu int, name varchar (), age int., area varchar (20));

Delete tables: drop table name; (Note: The table name can be changed, but the library name cannot be changed)

Renaming tables: Rename table Oldname to newname;

View table structure: DESC table name;

Statement input error, enter "\c", you can end the execution of the statement;

(4 basic operation of the table) increase, delete, check, change:

Insert: (Increase)

Insert into table name (ID, title, name, content) VALUES (1, ' hello ', ' ggg ', ' kkhely '), (2, ' hhoooo ', ' ffff ', ' Ggge ');

Update: (change)

Update indicates set id=2, content = ' GGLKJJK ' WHERE name = ' GGG '; (Conditions are set later)

Find: (check)

SELECT * from table name;

Select ID, title from table name where id>2;

Delete: (deleted)

Delete from table name where name= ' GGG ';(set novice mode, i.e. no where will not run the statement)

Note the point:

To resolve character Set issues:

The default build table is generally used UTF8, while Windows CMD is the GBK character set, so you need to declare the character set;

As follows:

Set name GBK;

Subject:

C + + uses hash table to implement English word lookup system

Getting Started with MySQL basics

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.