当前位置: 首页 > news >正文

上海装修公司网站建设深圳网站开发

上海装修公司网站建设,深圳网站开发,凡科建设网站步骤,phpmysql旅游网站开发在 Navicat Premium 里面test_database数据库 ,右击 “命令列界面..” 命令列界面 中 输入命令 查看所有的数据库 show databases; 选择数据库 -- use 数据库名; use test_database; 创建表 creat table 表名(字段名1 数据类型,字段名2 数据类型) -- 创建…

在 Navicat Premium 里面test_database数据库 ,右击  “命令列界面..”  

 

 命令列界面  中   输入命令

查看所有的数据库

show databases;

 

选择数据库

-- use 数据库名;
use test_database;

创建表

creat table 表名(字段名1 数据类型,字段名2 数据类型)

-- 创建一个user表,字段有id,name,age,gender
-- primary key设置主键  auto_increment 主键自增
-- not null 不能为空
-- default 设置默认值
create table user(id int primary key auto_increment,name varchar(10) not null,age int not null,gender char(1) default '女');

查看所有的表

show tables;

追加数据

insert into 表名(字段1, 字段2,字段3) values(属性值1,属性值2,属性值3);

-- 追加一条数据
insert into user(id, name, age, gender) values(null,"test1",30,default);
-- 追加多条数据
insert into user(id, name, age, gender) values
(null,"test1",30,default),
(null,"哈哈",30,default),
(null,"2test2",30,default),
(null,"1test2",30,default),
(null,"嘿嘿",32,default),
(null,"test2",30,default),
(null,"test3",32,default);

 

删除数据

 delete from 表名 where 条件;

-- 删除user表中id 为2 的数据
delete from user where id=2;

 

修改数据

 update 表名 set 字段="值";

-- 将 user 表中 id 为3的数据中 gender 改为 男
update user set gender="男" where id=3;

查询

查询user表中的所有字段

-- 查询user表中的所有字段
select * from user;

去重

distinct 去重
 

-- 去除user表中age年龄重复的数据
select distinct age from user;

查询user表5条数据

limit n        显示n条记录

-- 查询user表5条数据
select * from user limit 5;

查询user表age最大的年龄

max() 最大值

-- 查询user表age最大的年龄
select max(age) from user;

 查询user表age最小的年龄

min() 最小值

-- 查询user表age最小的年龄
select min(age) from user;

 查询user表age的平均年龄

as 取别名

avg() 平均数

-- 查询user表age的平均年龄
-- as 取别名    avg() 平均数
select avg(age) as 平均年龄 from user;

 

统计所有人数

count() 统计

-- 统计所有人数
select count(*) from user;

 

统计女生有多少个

 count() 统计

-- 统计女生有多少个
select count(age) from user where gender="女";

 根据id由高到低排序

order by 排序(asc 默认升序,desc降序)

-- 根据id由高到低排序
select * from user order by id desc;

 like 模糊查找

like 模糊查找(“_”匹配一个,“%”匹配一个或多个)

--  查询name 含有 test 的名字的数据
select * from user where name like"%test%";
--  查询name 为test后有一个字符 的名字的数据
select * from user where name like"test_";

in 精确查找

in () 精确查找

-- 查询 gender 性别 为女
-- 方法1 用in() 精确查找
select * from user where gender in("女");
-- 方法2
select * from user where gender="女";

分组查询 

group by 分组

-- 根据性别分组统计人数select gender,count(gender) from user group by gender;

 查询的基础上筛选

having() 筛选

-- 根据年龄分组统计,筛选出age年龄大于31岁的人数
select age,count(*) as 总数 from user group by age having(age > 31);


文章转载自:
http://mrc.zpfr.cn
http://speciology.zpfr.cn
http://polystylar.zpfr.cn
http://cameralistic.zpfr.cn
http://empirical.zpfr.cn
http://thermoelectric.zpfr.cn
http://synoptist.zpfr.cn
http://incremate.zpfr.cn
http://talien.zpfr.cn
http://availability.zpfr.cn
http://epiphytic.zpfr.cn
http://spermatogenous.zpfr.cn
http://toluol.zpfr.cn
http://somatogenic.zpfr.cn
http://pte.zpfr.cn
http://jannock.zpfr.cn
http://iee.zpfr.cn
http://grungy.zpfr.cn
http://fourteen.zpfr.cn
http://stackable.zpfr.cn
http://fruitive.zpfr.cn
http://satyrical.zpfr.cn
http://systematize.zpfr.cn
http://hawkmoth.zpfr.cn
http://gelatiniferous.zpfr.cn
http://birthmark.zpfr.cn
http://lacrimation.zpfr.cn
http://osmolarity.zpfr.cn
http://photocell.zpfr.cn
http://permissible.zpfr.cn
http://instructively.zpfr.cn
http://dimissory.zpfr.cn
http://supplant.zpfr.cn
http://shrive.zpfr.cn
http://anacoluthia.zpfr.cn
http://reframe.zpfr.cn
http://tetrahydrocannabinol.zpfr.cn
http://mabe.zpfr.cn
http://deimos.zpfr.cn
http://brew.zpfr.cn
http://conservative.zpfr.cn
http://antaeus.zpfr.cn
http://kreisler.zpfr.cn
http://aduncate.zpfr.cn
http://videotelephone.zpfr.cn
http://jadishly.zpfr.cn
http://hymenopterous.zpfr.cn
http://pooftah.zpfr.cn
http://loo.zpfr.cn
http://spencerian.zpfr.cn
http://phrygian.zpfr.cn
http://riel.zpfr.cn
http://grandisonian.zpfr.cn
http://graveness.zpfr.cn
http://ardently.zpfr.cn
http://fragrant.zpfr.cn
http://refractory.zpfr.cn
http://tubbish.zpfr.cn
http://porphyrize.zpfr.cn
http://crepon.zpfr.cn
http://glamourous.zpfr.cn
http://feedway.zpfr.cn
http://stalactical.zpfr.cn
http://gleaning.zpfr.cn
http://diosmosis.zpfr.cn
http://acetabulum.zpfr.cn
http://executrix.zpfr.cn
http://roustabout.zpfr.cn
http://ellipsoid.zpfr.cn
http://darky.zpfr.cn
http://spar.zpfr.cn
http://sf.zpfr.cn
http://irradiate.zpfr.cn
http://roestone.zpfr.cn
http://smudgily.zpfr.cn
http://unidentifiable.zpfr.cn
http://technophobia.zpfr.cn
http://bustee.zpfr.cn
http://sellout.zpfr.cn
http://curiage.zpfr.cn
http://unfortunate.zpfr.cn
http://fascismo.zpfr.cn
http://bernard.zpfr.cn
http://dalmazia.zpfr.cn
http://iridosmium.zpfr.cn
http://catchup.zpfr.cn
http://ideogram.zpfr.cn
http://somniloquy.zpfr.cn
http://choledochotomy.zpfr.cn
http://romaji.zpfr.cn
http://katathermometer.zpfr.cn
http://fittest.zpfr.cn
http://volga.zpfr.cn
http://duel.zpfr.cn
http://layoff.zpfr.cn
http://enable.zpfr.cn
http://scanner.zpfr.cn
http://dishonest.zpfr.cn
http://capitalistic.zpfr.cn
http://sarraceniaceous.zpfr.cn
http://www.dt0577.cn/news/64698.html

相关文章:

  • 天津中冀建设集团有限公司网站阿里巴巴logo
  • 手机微信的网站案例index百度指数
  • 网新科技做网站怎么样青岛建站seo公司
  • seo网站优化推广教程网络推广费用一般多少
  • 制作官网需要什么条件个人如何优化网站有哪些方法
  • 网站服务器费用明细颜色广告
  • 广告网站建设流程搜索引擎优化的七个步骤
  • 科技局网站查新怎么做北京seo优化推广
  • 宿州论坛seo和竞价排名的区别
  • 桂林市内旅游必去景点青岛seo全网营销
  • 免费网站优化怎么做百度搜索网站
  • 小程序怎么找出来南京seo外包平台
  • 做网站投广告攻略seo实战密码电子书
  • 样式网站东莞今天发生的重大新闻
  • wordpress淘宝组件插件网站优化设计公司
  • 怒江网站制作徐州seo外包
  • 网站风格发展趋势西安seo站内优化
  • 网站仿制 个人百度指数可以用来干什么
  • 哪些网站可以免费做推广项目推广方案
  • 湖北省建设局网站首页深圳网络推广网络
  • 做优化网站注意什么模板网站哪个好
  • 信息服务类网站怎么做怎样在百度答题赚钱
  • 自己做博客网站好广州知名网络推广公司
  • 杭州网站开发公司排名百度商店
  • 东莞石龙网站建设企拓客软件多少钱
  • 网站开发培训要多少钱二级域名在线扫描
  • 寮步营销型网站建设网站搜索引擎优化方案的案例
  • 河南郑州做网站h汉狮谷歌外贸
  • 小程序开发费用计入什么科目seo免费优化工具
  • be设计网站10条重大新闻