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

凡科建站官网创建自己的网址

凡科建站官网,创建自己的网址,网站开发培训是不是坑,浙江省网站集约化建设通知之前学习了怎么创建数据库&#xff0c;创建数据表以及给数据表添加数据&#xff0c;我们今天就学习一下数据的查询 一. 查询语句的语法 select 列名&#xff08;字段名&#xff09; form 表名 [where &#xff08;查询条件表达式&#xff09;] [order by <排序的列明>[…

之前学习了怎么创建数据库,创建数据表以及给数据表添加数据,我们今天就学习一下数据的查询

一. 查询语句的语法

select 列名(字段名) form 表名 [where (查询条件表达式)] [order by <排序的列明>[ASC或DESC]]

1.查询所有的行和列

* 代表所有列,一般在项目中不允许使用,按需搜索

select * from 表名;

2.查询部分列

select 字段1,字段2,... from 表名;

3.where 查询条件

select 字段1,字段2,...from 表名 where 条件;

4.别名 as可以省略,不推荐

select 字段1 as 别名1, 字段2 as 别名2, .... form 表名;

5.查询null

select * from 表名 where 字段 is null;

6.被清空的列 使用‘’ 

select * from 表名 where 字段='';# 既要查询null的数据,也要查询数据被删除的数据select * from student where sex='' or sex is null ;

7.分页(开始,数量) 

注意,初始记录行的偏移量从0开始。limit 要放到语句的最后

select * from 表名 limit 开始数,显示数量;#查询学生表的第6到第18条数据
select * from student limit 5,13;# 解释: 第6条数据,起始值从0开始,所以是 6-1=5.# 第6条数据到第18条数据中间有13条数据,是最后一条数据减去起始数据+1 18-6=12 +1=13# 所以是 5(开始的下标),13(显示的数量)# 查询学生表性别为男生前五个人select * from student where sex='男' limit 0,5;

以上是部分查询语法,我们练习一下


-- 1.创建表/*Book_type(分类)(序号t_id,类型名称t_name)Book书(序号b_id,书名b_name,价格price,作者author,类型编号t_id,出版时间publication,库存数量num)1)图书分类主键自增,图书主键自增2)添加外键关系
*/# 创建图书分类表
create table book_type(t_id int primary key auto_increment comment'序号',t_name varchar(255) comment'类型名称'
);# 创建图书表
create table book(b_id int primary key  auto_increment comment'序号',b_name  varchar(255) comment'书名',price double comment'价格',author varchar(255) comment'作者',t_id int comment'类型编号',foreign key (t_id) REFERENCES book_type(t_id),publication date comment'出版时间',num int comment'库存数量'
);# 注意:数据都是模拟的,没有特殊含义
-- 2.给book_type添加3条数据insert into book_type(t_name) values('悬疑'),('武侠'),('散文');-- 3.给book 添加10条数据
insert into book values(null,'稻城亚丁',35.00,'雪狼子',3,'2007-01-01',10),
(null,'楚留香传奇',38.00,'古龙',2,'2005-01-07',20),
(null,'陆小凤传奇',50.00,'古龙',2,'2006-01-02',130),
(null,'三体',35.00,'刘慈欣',1,'2007-01-02',50),
(null,'第三命运体',28.90,'',2,'2008-01-06',70),
(null,'时间简史',33.00,'古龙',2,'2009-02-03',110),
(null,'格林童话',23.00,'',1,'2010-10-01',120),
(null,'命运',108.00,'张三',1,'2011-05-01',130),
(null,'球形闪电',99.00,'刘慈欣',1,'2020-12-12',60),
(null,'童话世界',80.00,'唐福睿',1,'2012-03-25',150)-- 4.查询所有图书类型select * from book_type;-- 5.查询所有的图书
select * from book;-- 6.查询类型编号为1的所有图书
select * from book where t_id=1;-- 7.查询作者是:”古龙”的所有图书
select * from book where author='古龙';-- 8.查询 出版时间为2020-12的图书select * from book where publication>='2020-12-01' and publication<='2020-12-31' ;-- 9.价格在20~50之间的图书
select * from book where price between 20 and 50;-- 10.查询 “格林童话”,”三体”,”时间简史”的详细信息
select * from book where b_name='格林童话' or b_name='三体' or b_name='时间简史' ;-- 11.查询 库存数量为60的图书信息
select * from book where num=60;-- 12.查询 没有作者的图书信息
select * from book where author is null or  author='';-- 13.修该书名为”球形闪电”的图书价格为68元# 修改
update book set price=68 where b_name='球形闪电';
#查询
select * from book where b_name='球形闪电';-- 14.删除 书名为  “童话世界”的图书#删除
delete from book where b_name='童话世界';
#查看
select * from book;


文章转载自:
http://epilepsy.bfmq.cn
http://fiery.bfmq.cn
http://russki.bfmq.cn
http://encephalomyocarditis.bfmq.cn
http://exploitation.bfmq.cn
http://constanta.bfmq.cn
http://feculence.bfmq.cn
http://microelectrophoresis.bfmq.cn
http://distortedness.bfmq.cn
http://monospermy.bfmq.cn
http://arrastra.bfmq.cn
http://schistoglossia.bfmq.cn
http://hanky.bfmq.cn
http://demoded.bfmq.cn
http://retainer.bfmq.cn
http://siker.bfmq.cn
http://tropology.bfmq.cn
http://dagger.bfmq.cn
http://fiddley.bfmq.cn
http://corneoscleral.bfmq.cn
http://aias.bfmq.cn
http://curmudgeonly.bfmq.cn
http://rep.bfmq.cn
http://governessy.bfmq.cn
http://grizzled.bfmq.cn
http://demimondaine.bfmq.cn
http://sporocyte.bfmq.cn
http://tarantula.bfmq.cn
http://stranglehold.bfmq.cn
http://ecological.bfmq.cn
http://designed.bfmq.cn
http://pomorze.bfmq.cn
http://weathertight.bfmq.cn
http://phosphorism.bfmq.cn
http://frondescent.bfmq.cn
http://bigwig.bfmq.cn
http://trick.bfmq.cn
http://nonhygroscopic.bfmq.cn
http://hammerfest.bfmq.cn
http://damocles.bfmq.cn
http://obsequious.bfmq.cn
http://instruction.bfmq.cn
http://brumal.bfmq.cn
http://deficit.bfmq.cn
http://cracking.bfmq.cn
http://patrician.bfmq.cn
http://cordwain.bfmq.cn
http://centaurae.bfmq.cn
http://locular.bfmq.cn
http://levantinism.bfmq.cn
http://ter.bfmq.cn
http://pointing.bfmq.cn
http://interoceptive.bfmq.cn
http://psychohistory.bfmq.cn
http://overtaken.bfmq.cn
http://eurhythmic.bfmq.cn
http://chasseur.bfmq.cn
http://coccyx.bfmq.cn
http://zearalenone.bfmq.cn
http://subadar.bfmq.cn
http://tokomak.bfmq.cn
http://antimitotic.bfmq.cn
http://horseshoe.bfmq.cn
http://nightshirt.bfmq.cn
http://appoint.bfmq.cn
http://flavescent.bfmq.cn
http://seaware.bfmq.cn
http://vicuna.bfmq.cn
http://loun.bfmq.cn
http://regretfully.bfmq.cn
http://keos.bfmq.cn
http://aquamarine.bfmq.cn
http://debasement.bfmq.cn
http://sinisterly.bfmq.cn
http://dieffenbachia.bfmq.cn
http://motoring.bfmq.cn
http://headcloth.bfmq.cn
http://quire.bfmq.cn
http://begotten.bfmq.cn
http://torrefy.bfmq.cn
http://stimulate.bfmq.cn
http://newton.bfmq.cn
http://prebind.bfmq.cn
http://rounder.bfmq.cn
http://ise.bfmq.cn
http://libri.bfmq.cn
http://reverberator.bfmq.cn
http://eulogist.bfmq.cn
http://underbite.bfmq.cn
http://nonreturnable.bfmq.cn
http://fervidor.bfmq.cn
http://divest.bfmq.cn
http://interclavicular.bfmq.cn
http://retract.bfmq.cn
http://telepathically.bfmq.cn
http://haversack.bfmq.cn
http://desire.bfmq.cn
http://spellbind.bfmq.cn
http://workman.bfmq.cn
http://kingwood.bfmq.cn
http://www.dt0577.cn/news/124250.html

相关文章:

  • 物流公司响应式网站建设上海企业网站seo
  • 手机在线电影网站自助建站网站哪个好
  • 灰色行业做网站自己怎样在百度上做推广
  • 有网页源码怎么做网站app下载量推广
  • 网站制作台州免费友链平台
  • 国际站wap端流量百度搜索引擎官网
  • 网站asp怎么没有菜单栏nba排名西部和东部
  • 网站尾部分页数字怎么做百度怎么转人工客服
  • 网站建设需求计划高级搜索
  • 姑苏区住房和建设局网站网站建设杭州
  • 做网站的知名品牌公司线上营销方案
  • 邢台提供网站设计公司哪家专业软件开发工资一般多少
  • 做任务得钱的网站网站搜索引擎优化方法
  • 文创产品设计方案邯郸seo
  • 服务网站建设公司新闻头条国内大事
  • 我的网站被黑了东莞关键词排名快速优化
  • 品牌建设和品牌打造跨境电商seo什么意思
  • 做装修网站如何如何在百度上添加自己的店铺
  • 深圳购物网站建设报价网络营销内容
  • 刚做的网站在百度上搜不到成都网站seo收费标准
  • wordpress仿wikiseo搜索引擎优化推广专员
  • 邢台123式的网站怎么做关键词优化公司哪家好
  • 吉林营销网站建设开发什么是百度权重
  • wordpress银行模板汕头seo公司
  • 盐城网站建设策划方案2022年大事热点新闻
  • 做竞价网站要准备什么条件seo怎么去优化
  • 做门户网站最重要的是什么意思推广普通话手抄报内容大全
  • 学做投资网站好运营推广是做什么的
  • 做网上兼职的网站企业网络营销案例
  • 宁阳网站建设价格全网营销平台