码迷,mamicode.com
首页 > 数据库 > 详细

MySQL数据库基本操作

时间:2016-06-09 14:45:25      阅读:229      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!