MySQL Learning notes

Source: Internet
Author: User

/*
Reprint please indicate the source, ID: Cherish the youth when
*/
Turn on MySQL service: net start MySQL
Turn off MySQL service: net stop MySQL
For this reason, if there is missing hope to inform the remedy. Follow-up will also increase or decrease the operation.

------------------------------------------------------------------------------------------------

Mysql-h127.0.0.1 -P3306 -Uroot-p123456 MySQL>Createdatatabase test; #创建一个test数据库mysql> Usetest; #使用test这个数据库mysql>Drop Databasetest; #删除数据库mysql>show databases; #显示所有的数据库00x1[Table Creation Instance]------------------------------------------------------------------------------Mysql>Create TableAdmin (#创建一个admin表mysql>Idint, #创建字段id, the data type is int type mysql>Namevarchar(255), #创建字段name, the data type is Varcharmysql>Passwordvarchar(255) #创建字段password with a data type of Varcharmysql>); #更多数据类型可参考: http://Www.cnblogs.com/Xishaonian/P/6009605. html-------------------------------------------------------------------------------------------------Mysql>desctest; #查询表结构mysql>Drop Tabletest; #删除test表00x1[Insert]-------------------------------------------------------------------------------Mysql>Insert  intoAdmin'ID','name','Password') Value (1, "Ergou", "," a123456 "); The #在admin表中插入 (Id,name,password) value. 00x2[Federated Queries]---------------------------------------------------------------------------Mysql>Select *  fromadmin; #选择admini表. List all of its data (Xin symbol is all meaning) 00x3[Update, Updata]-----------------------------------------------------------------------------Mysql>UodataUser Set SetId= the whereName='Ergou'  andPassword='123456'#更新user表, update the field ID with name equal to Ergou and password equals 123456 to 11000x4[show the name rename]----------------------------------------------------------------Mysql>RenameTableAuto toprice;00x5[Specify delete data, Delect]----------------------------------------------------------------Mysql>Delect fromBookwhereId="1"; 00x6[Select field query data]----------------------------------------------------------------Mysql>SelectAuto,prince frombook;00x7[Modify field query data, alert]----------------------------------------------------------------Mysql>AlertTableAdmin Change ustUser varchar(255); Alter TableTable name change existing field name Modified field name data type 00x8[fuzzy query, like]----------------------------------------------------------------Mysql>SelectBookname,auto,username fromBookwhereBookName like"%Php%"; 00x8[query result sort, desc]----------------------------------------------------------------Mysql>SelectId,name,price fromBookOrder  byIddesc; #倒序排列, ascending is asc00x9[limit query, limit]----------------------------------------------------------------Mysql>SelectId,name,price from Order  byUddescLimit0,5; 01x0[alias, as]----------------------------------------------------------------SelectBookName as 'Library', Suto as 'author'  frombook;01x0[Union query, Union]----------------------------------------------------------------Mysql>SelectBookName fromBookUnion SelectBookprice fromBOOK;MSYQL>Select distinctTest fromHello #去除hello表下的test列重复的.

MySQL Learning notes

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.