首页 > 数据库技术 > 详细

MySQL数据库基本操作

时间:2016-06-09 14:44:37      阅读:200      评论:0      收藏:0      [点我收藏+]

重点内容修改下列脚本mysql_practice.sql,进行练习mysql基本操作:

show databases;
create database if not exists `HA`;
use HA;
create table if not exists student (id int, name char(40), age int);
show create table student \G;
desc student;
create table student2 (id int(20), name char(40), age int) ENGINE=InnoDB DEFAULT CHARSET=utf8;
show columns from student2;
drop table student2;
alter table student rename students;
show tables;
alter table students modify id int(10);
show fields from students;
alter table students modify id int(20) primary key;
show fields from students;
alter table students change name stname char(20);
desc students;
alter table students add sex enum(M,W);
desc students;
alter table students add uid int(10) first;
desc students;
alter table students add address char(50) after age;
desc students;
alter table students drop address;
insert into students values(1,1,liqiang,22,M);
insert into students(uid,id) values(2,2);
select * from students;
select uid,id from students;
select * from HA.students \G;
show tables;
drop table if exists students;
show tables;
show databases;
drop database if exists `HA`;
show databases;

 

MySQL数据库基本操作

原文:http://www.cnblogs.com/xianren2016/p/5572309.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!