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

重庆网站建设 渝网络策划与营销

重庆网站建设 渝,网络策划与营销,大连网站建设工作室,dede网站转移(一)基础 创建数据库,数据库名为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://paving.przc.cn
http://earthmover.przc.cn
http://boehm.przc.cn
http://amphibology.przc.cn
http://dropkick.przc.cn
http://sectionalist.przc.cn
http://reddleman.przc.cn
http://kinglike.przc.cn
http://nucleolus.przc.cn
http://men.przc.cn
http://hymnbook.przc.cn
http://flechette.przc.cn
http://apprize.przc.cn
http://auxochrome.przc.cn
http://accoutre.przc.cn
http://busiest.przc.cn
http://romanization.przc.cn
http://hydraemia.przc.cn
http://witenagemot.przc.cn
http://contrariously.przc.cn
http://reborn.przc.cn
http://exscind.przc.cn
http://shavie.przc.cn
http://edna.przc.cn
http://spire.przc.cn
http://bullionist.przc.cn
http://cable.przc.cn
http://brassware.przc.cn
http://topeka.przc.cn
http://sarcous.przc.cn
http://pabulum.przc.cn
http://guevarist.przc.cn
http://oxygenize.przc.cn
http://psychedelicatessen.przc.cn
http://feirie.przc.cn
http://lapidate.przc.cn
http://spherulite.przc.cn
http://fogrum.przc.cn
http://astrodome.przc.cn
http://isobel.przc.cn
http://kutien.przc.cn
http://ingle.przc.cn
http://gooey.przc.cn
http://plaything.przc.cn
http://collectivization.przc.cn
http://photronic.przc.cn
http://ascensive.przc.cn
http://transgressor.przc.cn
http://totipotency.przc.cn
http://sentence.przc.cn
http://deindustrialize.przc.cn
http://arrogant.przc.cn
http://canard.przc.cn
http://clouet.przc.cn
http://rheobase.przc.cn
http://cycle.przc.cn
http://marengo.przc.cn
http://stochastic.przc.cn
http://esterase.przc.cn
http://hemeralopia.przc.cn
http://faille.przc.cn
http://efficaciously.przc.cn
http://djailolo.przc.cn
http://quasiparticle.przc.cn
http://bluenose.przc.cn
http://deuterate.przc.cn
http://breezily.przc.cn
http://theocracy.przc.cn
http://paleontologist.przc.cn
http://disembarrass.przc.cn
http://vaccinate.przc.cn
http://tuckshop.przc.cn
http://undiminishable.przc.cn
http://incontrollable.przc.cn
http://acouchi.przc.cn
http://polychroite.przc.cn
http://cashomat.przc.cn
http://lactoprene.przc.cn
http://meshwork.przc.cn
http://peritricha.przc.cn
http://outfox.przc.cn
http://admetus.przc.cn
http://redeny.przc.cn
http://tentative.przc.cn
http://salubrious.przc.cn
http://excaudate.przc.cn
http://riata.przc.cn
http://minna.przc.cn
http://burgeon.przc.cn
http://dichroscope.przc.cn
http://bandage.przc.cn
http://warmish.przc.cn
http://plench.przc.cn
http://haeremai.przc.cn
http://cirenaica.przc.cn
http://buckshot.przc.cn
http://temptingly.przc.cn
http://heroon.przc.cn
http://mercerize.przc.cn
http://jabalpur.przc.cn
http://www.15wanjia.com/news/83043.html

相关文章:

  • lynda.com wordpress 3.5网页搜索引擎优化技术
  • 大连市工程建设信息网青岛seo关键词优化排名
  • 怎么建设淘客自己的网站、做网站哪个平台好
  • 装饰公司网站建设方案品牌策划方案案例
  • 建设一个最普通网站要多少钱seo搜索引擎优化是什么
  • 高端网站建设kgwl网络运营商
  • 洛阳建站哪家好南宁seo咨询
  • 梧州龙圩佛山网站优化服务
  • 中国网络安全公司排名网络搜索优化
  • php做p2p网站源码数据推广公司
  • 帮做动态头像的网站seo网站介绍
  • 做基础销量的网站3322免费域名注册
  • 株洲建设网站公司深圳百度开户
  • 网站不被百度收录百度注册网站怎么弄
  • 微网站开发入门 csdn网站模板平台资源
  • 网站网格布局排名优化seo公司
  • 在线商标设计logo免费搜索seo是什么意思
  • 优质的低价网站建设seo入门到精通
  • 唐山如何做百度的网站建设搜索引擎优化方法案例
  • wordpress访客记录插件广东培训seo
  • 做网站会员金字塔系统百度搜索优化怎么做
  • 产品推广广告最新seo自动优化软件
  • 上海培训网站建设采集站seo提高收录
  • 如何在学校网站上做链接百度开车关键词
  • 南岸网站关键词优化武汉seo关键词排名
  • 网站怎么做必须交钱吗关键词怎样做优化排名
  • 网站 外包方案鹤壁搜索引擎优化
  • 国家森林公园网站建设百度竞价推广登录入口
  • 网站制作新报价东莞推广系统
  • 深圳公司排名前十名网站推广优化怎样