首页 > 代码库 > 学习简单数据库表操作(Mysql)2

学习简单数据库表操作(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;

技术分享

 

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