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

sql基础操作

时间:2014-05-18 09:01:30      阅读:360      评论:0      收藏:0      [点我收藏+]

标签:sql

有些基础的语句很久没用会生疏,所以写个例子把所有的基础语句都写一遍,以便加深记忆。

drop table  if EXISTS stu;
create table stu(
name varchar(32),
age int,
stuid int,
idnum int,
sex varchar(30),
PRIMARY KEY(idnum),
check (sex in(‘男‘,‘女‘))
)CHARSET=utf8; 
insert into stu values(‘tom‘,12,2010,123,‘男‘);
insert into stu (name,age,stuid,idnum,sex) values(‘wilson‘,13,3465,676,‘女‘);
update stu set age=15 where name=‘tom‘ or name=‘wilson‘;
SELECT name,age from stu  WHERE age BETWEEN 0 and 20 order by name asc;
DELETE from stu where name=‘tom‘;
select * from stu where age BETWEEN 0 and 20 order by name desc;

用的是mysq front 很好用的工具,推荐给大家!

sql基础操作,布布扣,bubuko.com

sql基础操作

标签:sql

原文地址:http://blog.csdn.net/linsheng9731/article/details/26018927

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