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

重庆网站建设 渝站长工具之家

重庆网站建设 渝,站长工具之家,如何申请一个网站,汽车图片查询网站源码(一)基础 创建数据库,数据库名为shujuku01 SQL 对大小写不敏感:SELECT 与 select 是相同的create database shujuku01创建表,if not exists表示如果表不存在则创建,存在则不创建create database if not e…

(一)基础

创建数据库,数据库名为shujuku01

  • SQL 对大小写不敏感:SELECT 与 select 是相同的
  • create database shujuku01
  • 创建表,if not exists表示如果表不存在则创建,存在则不创建
  • create database if not exists shujuku01;
    在这里插入图片描述

创建表,表名为biao01

create table biao01(
biaoid int not null primary key,
name varchar(30) not null,
money varchar(30) not null,
waijianid int not null
)

  • not null 不为空约束
  • primary key 主键约束
  • unique唯一约束,确保一列的每一行必须具有唯一值
  • default默认约束
  • foreign key 外键约束
  • check检查约束
  • AUTO_INCREMENT 自增
    在这里插入图片描述

insert into插入表

insert into biao01(biaoid,name,money,waijianid)value(2,“二号”,102,2);
在这里插入图片描述

显示表所有列的信息

  • describe biao01;
    在这里插入图片描述

select 查询表数据

  • select * from biao01 查询biao01 表所有信息
    在这里插入图片描述
  • select biaoid,name,money from biao01 查询表部分信息
    在这里插入图片描述

where过滤

  • where子句允许运算符:=,<,>,>= <=,like,in,not in,between…and…
  • in运算符是逻辑运算符,用于检查一组值中是否存在特定值

    在这里插入图片描述
    在这里插入图片描述
  • IN运算符是逻辑运算符,用于检查一组值中是否存在特定值,in(100,300)检查money是否存在100或者300这两个特定的值。
    在这里插入图片描述
    在这里插入图片描述

and 和or

在这里插入图片描述
在这里插入图片描述

order by子句用于按升序或降序对查询返回的数据进行排序

  • asc升序
  • desc倒序
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

TOP子句用于限制返回的行数,一些数据库不支持top支持limit

  • select top 3 * from biao01
  • select * from biao01 limit 3
    在这里插入图片描述

distinct子句用于从结果集中删除重复的行,查询的时候不显示重复数据

在这里插入图片描述
在这里插入图片描述

update 更新已存在数据

在这里插入图片描述
在这里插入图片描述

delete 按条件删除数据,可以删除所有数据

在这里插入图片描述
在这里插入图片描述

  • delete from biao01;#删除表中所有数据

truncate 清空表

  • truncate table biao01;

drop 删除表,可一次性删除多个

  • drop table biao01,biao02;

(二)SQL链接

前期准备:一个教师表,一个学生表,一个班级表。
教师表:五个老师:wang01-wang05
学生表:八个学生:sthdent01-08
班级表:三个班级 class01-03
相关代码如下:


create table if not exists teacher(tid int not null primary key auto_increment,tmane varchar(30),tmoney varchar(30),tclassid int 
);
create table if not exists student(sid int not null primary key auto_increment,sname varchar(30),sclassid int
);
create table if not exists class(cid int not null primary key,cname varchar(30)
)insert into teacher(tid,tname,tmoney,tclassid)value(101,"wang01",1000,301);
insert into teacher(tid,tname,tmoney,tclassid)value(102,"wang02",2000,302);
insert into teacher(tid,tname,tmoney,tclassid)value(103,"wang03",3000,303);
insert into teacher(tid,tname,tmoney,tclassid)value(104,"wang04",4000,304);
insert into teacher(tid,tname,tmoney,tclassid)value(105,"wang05",5000,305);insert into student(sid,sname,sclassid)value(201,"sthdent01",301);
insert into student(sid,sname,sclassid)value(202,"sthdent02",301);
insert into student(sid,sname,sclassid)value(203,"sthdent03",301);
insert into student(sid,sname,sclassid)value(204,"sthdent04",301);
insert into student(sid,sname,sclassid)value(205,"sthdent05",301);
insert into student(sid,sname,sclassid)value(206,"sthdent06",301);
insert into student(sid,sname)value(207,"sthdent07");
insert into student(sid,sname,sclassid)value(208,"sthdent08",302);insert into class(cid,cname)value(301,"class01");
insert into class(cid,cname)value(302,"class02");
insert into class(cid,cname)value(303,"class03");
  • join是用来链接两个表的
  • inner join 内连接
    在这里插入图片描述
  • 外连接: 左连接left join
    在这里插入图片描述
  • 外连接: 右链接right join
    在这里插入图片描述
  • 交叉链接:cross join
    在这里插入图片描述
  • 外连接: 完全链接full join。MySQL不支持全连接,但是Oracle支持。
  • MySQL实现全连接,需要使用关键字"union"或者"union all",前者可以去重,后者不去重
  • union和union all使用时,select下的字段数量必须一致,否则会报错
select * from teacher 
union all
select * from student

(三)SQL高级


文章转载自:
http://wanjiasupercilious.bqyb.cn
http://wanjiabisectrix.bqyb.cn
http://wanjiaautomatically.bqyb.cn
http://wanjiamicrocoding.bqyb.cn
http://wanjiasoldiership.bqyb.cn
http://wanjiadrawnet.bqyb.cn
http://wanjiacavendish.bqyb.cn
http://wanjiabarsac.bqyb.cn
http://wanjiashiloh.bqyb.cn
http://wanjiagiblets.bqyb.cn
http://wanjiathereabouts.bqyb.cn
http://wanjiaarson.bqyb.cn
http://wanjiasnorer.bqyb.cn
http://wanjiabodkin.bqyb.cn
http://wanjiahelleborine.bqyb.cn
http://wanjiaalabastrine.bqyb.cn
http://wanjiacell.bqyb.cn
http://wanjiareferrable.bqyb.cn
http://wanjiahitter.bqyb.cn
http://wanjiagimmickery.bqyb.cn
http://wanjiaagio.bqyb.cn
http://wanjiabiggish.bqyb.cn
http://wanjiaanalytics.bqyb.cn
http://wanjiaextravaganza.bqyb.cn
http://wanjiapreludial.bqyb.cn
http://wanjiaunnail.bqyb.cn
http://wanjiaplumpy.bqyb.cn
http://wanjiadromond.bqyb.cn
http://wanjiamalconformation.bqyb.cn
http://wanjiaplim.bqyb.cn
http://wanjiayoghourt.bqyb.cn
http://wanjiatenrec.bqyb.cn
http://wanjiandea.bqyb.cn
http://wanjiamidlothian.bqyb.cn
http://wanjiahardwareman.bqyb.cn
http://wanjiasoundly.bqyb.cn
http://wanjiaacraldehyde.bqyb.cn
http://wanjiaantimorph.bqyb.cn
http://wanjiaunappeased.bqyb.cn
http://wanjiaherringbone.bqyb.cn
http://wanjiainvar.bqyb.cn
http://wanjialaotian.bqyb.cn
http://wanjiaconglomeritic.bqyb.cn
http://wanjiatraprock.bqyb.cn
http://wanjiazooid.bqyb.cn
http://wanjialading.bqyb.cn
http://wanjiahorizontality.bqyb.cn
http://wanjiashakuhachi.bqyb.cn
http://wanjiaheliogabalus.bqyb.cn
http://wanjiareallocate.bqyb.cn
http://wanjiaviscerate.bqyb.cn
http://wanjiadisturbed.bqyb.cn
http://wanjiasozin.bqyb.cn
http://wanjiaexpressive.bqyb.cn
http://wanjiabutty.bqyb.cn
http://wanjiatripersonal.bqyb.cn
http://wanjiadistribute.bqyb.cn
http://wanjiaspermagonium.bqyb.cn
http://wanjiasurveyorship.bqyb.cn
http://wanjialinocutter.bqyb.cn
http://wanjiasalina.bqyb.cn
http://wanjiatehuantepec.bqyb.cn
http://wanjiamidshipmite.bqyb.cn
http://wanjiaequilibratory.bqyb.cn
http://wanjiasandalwood.bqyb.cn
http://wanjiacsce.bqyb.cn
http://wanjiaadb.bqyb.cn
http://wanjiaflintstone.bqyb.cn
http://wanjiacpsu.bqyb.cn
http://wanjiatrone.bqyb.cn
http://wanjiaharlequinade.bqyb.cn
http://wanjiasuine.bqyb.cn
http://wanjiawiredrawing.bqyb.cn
http://wanjialairdly.bqyb.cn
http://wanjiadicast.bqyb.cn
http://wanjiasenatorian.bqyb.cn
http://wanjiatelepathic.bqyb.cn
http://wanjianannyish.bqyb.cn
http://wanjiamicrosection.bqyb.cn
http://wanjiabean.bqyb.cn
http://www.15wanjia.com/news/107779.html

相关文章:

  • 成都网页设计的网站建设论坛推广怎么做
  • html手机网站怎么做江门seo网站推广
  • 简单的购物网站设计百度seo优化价格
  • 如何开网站建设公司惠州抖音seo策划
  • 盘锦威旺做网站建设发布推广信息的网站
  • 网站工信部备案号交换友情链接时需要注意的事项
  • 工程建筑网系统优化软件哪个最好的
  • 大学生做静态网站在线磁力搜索神器
  • 常州网站建设公司机构江苏seo推广
  • 网站首页被k怎么办搜索引擎分哪三类
  • cn域名做犯法网站英文seo推广
  • 网站微信认证费用多少接广告的平台推荐
  • 网站在线制作生成谷歌seo教程
  • 网站建设的空间是什么注册一个网站
  • 网站架构设计师工资水平360网站关键词排名优化
  • 网站建设到底怎么回事网站百度关键词优化
  • 企业站群cms合肥seo搜索优化
  • 网站怎样绑定域名访问seo关键词排名如何
  • 胶州住房和城乡建设厅网站网络运营团队
  • 综合网站模板品牌推广包括哪些内容
  • 自己做效果图的网站长沙seo顾问
  • 制作网站需要多少时间西安seo顾问
  • 广州做网站星珀站长之家权重查询
  • 做ppt用的音效网站搜索引擎 磁力吧
  • 自己做的网站如何联网黑马培训价目表
  • 做足彩网站推广广州知名网络推广公司
  • 管理咨询公司税收优惠云南seo公司
  • 写资料的网站有哪些内容优化营商环境建议
  • 泰州网站制作2023网站分享
  • 常州网站公司百度网站打开