标签:mit alt password ice show set alter 显示 等于
/*
转载请注明出处,ID:珍惜少年时
*/
开启mysql服务:net start mysql
关闭mysql服务:net stop mysql
姑且如此,如有漏缺望告知弥补。后续也会增减等操作。
------------------------------------------------------------------------------------------------
mysql -h127.0.0.1 -P 3306 -uroot -p123456 mysql>create datatabase test; #创建一个test数据库 mysql>use test; #使用test这个数据库 mysql>drop database test; #删除数据库 mysql>show databases; #显示所有的数据库 00x1[表创建实例]------------------------------------------------------------------------------ mysql>create table admin( #创建一个admin表 mysql>id int, #创建字段id,数据类型为int型 mysql>name varchar(255), #创建字段name,数据类型是varchar mysql>password varchar(255) #创建字段password,数据类型为varchar mysql>); #更多数据类型可参考:http://www.cnblogs.com/xishaonian/p/6009605.html ------------------------------------------------------------------------------------------------- mysql>desc test; #查询表结构 mysql>drop table test; #删除test表 00x1[插入]------------------------------------------------------------------------------- mysql>insert into admin(‘id‘,‘name‘,‘password‘) value(1,"ergou",","a123456"); #在admin表中插入(id,name,password)值。 00x2[联合查询]--------------------------------------------------------------------------- mysql>select * from admin; #选择admini表。列出所有其数据(鑫号代表全部的意思) 00x3[更新,updata]----------------------------------------------------------------------------- mysql>uodata user set set id=110 where name=‘ergou‘ and password=‘123456‘; #更新user表,让name等于ergou的和password等于123456的字段ID更新为110 00x4[表明重明名,rename]---------------------------------------------------------------- mysql>rename table auto to price; 00x5[指定删除数据,delect]---------------------------------------------------------------- mysql>delect from book where id="1"; 00x6[选定字段查询数据]---------------------------------------------------------------- mysql>select auto,prince from book; 00x7[修改字段查询数据,alert]---------------------------------------------------------------- mysql>alert table admin change ust user varchar(255); alter table 表名 change 现有字段名称 修改后字段名称 数据类型 00x8[模糊查询,like]---------------------------------------------------------------- mysql>select bookname,auto,username from book where bookname like "%php%"; 00x8[查询结果排序,desc]---------------------------------------------------------------- mysql>select id,name,price from book order by id desc; #倒序排列,升序是asc 00x9[限定查询,limit]---------------------------------------------------------------- mysql>select id,name,price from order by ud desc limit 0,5; 01x0[别名,as]---------------------------------------------------------------- select bookname as ‘图书室‘ , suto as ‘作者‘ from book; 01x0[联合查询,union]---------------------------------------------------------------- mysql>select bookname from book union select bookprice from book; msyql>select distinct test from hello; #去除hello表下的test列重复的。
标签:mit alt password ice show set alter 显示 等于
原文地址:http://www.cnblogs.com/xishaonian/p/6014235.html