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

MySQL 基本操作

时间:2015-09-28 15:58:21      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:

create database foo chareset utf8;

create table foo(
user_name varchar(20),
age int,
signup_date date
);

insert into foo values(‘iwen‘,‘28‘,‘2015-01-01‘);
select * from foo;

select name, age, signup_date from foo;
insert into foo values(‘ime‘,‘21‘,‘2015-12-21‘);

select * from foo where user_name = ‘iwen‘;

select * from foo where user_name = ‘iwen‘ and age = 28;

update foo set age = 30 where user_name = ‘iwen‘;
select * from foo;

delete from foo where user_name = ‘iwen‘;


alter table foo add email varchar(50);
alter table foo drop email;
alter table foo change age user_age int;
alter table foo change user_age tinyint(1) not null;
alter table foo rename user_tbl;
drop table user_tbl;

MySQL 基本操作

标签:

原文地址:http://www.cnblogs.com/htmlphp/p/4844062.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!