学习简单数据库表操作(Mysql)2

 以orcl实例下,person表为例:

1.登录mysql:

mysql安装路径下,bin目录,打开命令窗口,输入mysql -u用户名 -p密码;

2.显示所有实例,show databases;

3.进入orcl实例,use orcl;

 

4.显示person表字段信息,desc person;

5.修改字段描述,alter table person change pid PID int(11) not null;

6.修改表名,alter table person rename to people;

 

7.查,select *from person;

8.增,insert into person(name,age,birthday,salary) values('Ming',11,'1999-01-01',1000);

9.改,update person set name = 'XiaoLi' where pid = 11;

10.删,delete from person where pid = 10;

 

11.数,select count(1), age from person group by age;

12.排序,select name,salary from person order by salary asc;

 

select name,salary from person order by salary desc;

 

posted @ 2017-03-10 22:35  earshore  阅读(179)  评论(0编辑  收藏  举报