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

Navicat Premium mysql

时间:2016-07-22 22:45:24      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:

#Sql语句  创建一表格
create table user3(id int(11),name varchar(32),age int (3),sex char(1));

#添加语句
insert into user3(id ,name,age,sex)values(1,张三,99,);
insert into user3 values(4,王五,21,);
#删除
delete from user3;#user3中所有数据全删
delete from user3 where name=张三;
delete from user3 where name=张三 and age=99;#and 出现在条件与条件之间
delete from user3 where name=张三 & age=99;#???为何没效果 &最好不用,Java中转义字符
#修改
update user3 set sex= where name=李四 and age=22;
update user3 set sex=,age=2 where name=李四 and age=22;#同时改多个
#查询
select name,id,age,sex from user3;#查询所有
select * from user3;#查询所有 顺序
select name from user3;#查询所有姓名
select id,name,age,sex from user3 where name=李四 and age=2;
select id,name,age,sex from user3 where name=李四 or age=2;

select * from user3 order by id asc;#按id 升序排列
select * from user3 order by id desc;#按id 降序排列

 

Navicat Premium mysql

标签:

原文地址:http://www.cnblogs.com/kimsimple/p/5697096.html

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