中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

重慶安全員c證在哪里報(bào)名百度搜索怎么優(yōu)化

重慶安全員c證在哪里報(bào)名,百度搜索怎么優(yōu)化,linux wordpress 中文字體,英國政府網(wǎng)站建設(shè)的特點(diǎn)結(jié)構(gòu)化查詢語言 DDL(數(shù)據(jù)定義語言) 刪除數(shù)據(jù)庫drop database DbName; 創(chuàng)建數(shù)據(jù)庫create database DbName; 使用數(shù)據(jù)庫use DbName; 查看創(chuàng)建數(shù)據(jù)庫語句以及字符編碼show create database 43th; 修改數(shù)據(jù)庫屬性(字符編碼改為gbk)…

結(jié)構(gòu)化查詢語言

DDL(數(shù)據(jù)定義語言)

刪除數(shù)據(jù)庫drop database DbName;
創(chuàng)建數(shù)據(jù)庫create database DbName;
使用數(shù)據(jù)庫use DbName;
查看創(chuàng)建數(shù)據(jù)庫語句以及字符編碼show create database 43th;
在這里插入圖片描述
修改數(shù)據(jù)庫屬性(字符編碼改為gbk)alter database DbName default character set gbk;
在這里插入圖片描述
字符校對(duì)集
查看數(shù)據(jù)庫支持的字符集show character set;
在這里插入圖片描述

查看相應(yīng)字符集的校對(duì)規(guī)則show collation;
在這里插入圖片描述
數(shù)據(jù)類型
在這里插入圖片描述
TIMESTAMP在進(jìn)行insert/updata自動(dòng)記錄

創(chuàng)建表結(jié)構(gòu)

create table tName(field1 datatype,field2 datatype,...
);

在這里插入圖片描述
查看表結(jié)構(gòu)desc tName; show create table person;
在這里插入圖片描述

修改表結(jié)構(gòu)
添加列(字段)alter table tName add field datatype;
在這里插入圖片描述
對(duì)字段名進(jìn)行修改alter table tName change field1 field2datatype;
在這里插入圖片描述
對(duì)字段名的類型進(jìn)行修改alter table tName modify field datatype;
在這里插入圖片描述

刪除一個(gè)字段alter yable tName drop field;
在這里插入圖片描述
刪除表結(jié)構(gòu)drop table tName;
在這里插入圖片描述
查看數(shù)據(jù)庫中有多少表show tables;
在這里插入圖片描述

DML(數(shù)據(jù)控制語言)

在表中對(duì)指定的列插入數(shù)據(jù)insert into tName(field1,field2...) values (field1Vale,field2Vale...);
在這里插入圖片描述
對(duì)所有列都進(jìn)行數(shù)據(jù)添加insert into tName values(field1Vale,field2Vale....);

在這里插入圖片描述
對(duì)所有列添加多行數(shù)據(jù)insert into tName(field1,field2...) values(field1vale,field2vale....),(field1Vale,field2Vale....),...;效率高于每次insert一條語句
在這里插入圖片描述
修改某一條數(shù)據(jù)進(jìn)行修改update tName set field1=XXX[where..];
帶where作用于某一行,不帶where作用于所有行
在這里插入圖片描述
添加新的列alter table tName add coluName coluType;
在這里插入圖片描述
復(fù)制表

復(fù)制表結(jié)構(gòu)不復(fù)制數(shù)據(jù)create table newTName like oldTName;
在這里插入圖片描述

復(fù)制表結(jié)構(gòu)和數(shù)據(jù)create table newTName select * from oldTName;
在這里插入圖片描述

刪除表中數(shù)據(jù)不刪除表結(jié)構(gòu)delete from tName[whilecondition];
在這里插入圖片描述
在這里插入圖片描述

DQL(數(shù)據(jù)查詢語言)

查詢命令select[*]|{field1,field2...}while tName [where condition];
在這里插入圖片描述
去除重復(fù)列,使用distinct關(guān)鍵字,當(dāng)distinct作用于單個(gè)字段時(shí),去除重復(fù)的列即可,當(dāng)distinct作用于多個(gè)字段時(shí),必須要所有字段相同才可以消除
distinct必須放在第一個(gè)關(guān)鍵字之前,不然會(huì)報(bào)錯(cuò)
在這里插入圖片描述
select語句選擇的列可以進(jìn)行運(yùn)算
使用as還可以對(duì)列區(qū)別名
在這里插入圖片描述
獲取當(dāng)前使用數(shù)據(jù)庫 select database();
在這里插入圖片描述
獲取當(dāng)前時(shí)間,使用curdate()函數(shù)
在這里插入圖片描述
選擇查詢select id,name,chinese from person where chinese between 10 and 90;
枚舉查詢select id,name,chinese from person where chinese in(88,77,90,60);
模糊查詢like
通配符_:下劃線代表一個(gè)任意字符select * from person where name like '-i';
通配符%:百分號(hào)代表多個(gè)字符slelect * from person name like 'z%';

對(duì)查詢的結(jié)果集進(jìn)行排序默認(rèn)采用升序ASC方式排序,DESC為降序select [*] from tName orger by culName;
在這里插入圖片描述

分頁查詢(常考點(diǎn))

(1)第一種寫法limit
只是查看前三名的字段select * from person order by english desc limit 3;
在這里插入圖片描述
每頁三個(gè)數(shù)據(jù),查看第二頁的數(shù)據(jù)select * from person order by english desc limit 3,3;
在這里插入圖片描述
(2)第二種寫法limit m offset n n表示的是偏移記錄條數(shù),m表示要顯示的數(shù)據(jù)條數(shù)

只是查看前三名的字段select * from person order by english desc limit 3 offset 0;
在這里插入圖片描述
每頁三個(gè)數(shù)據(jù),查看第二頁的數(shù)據(jù)select * from person order by english desc limit 3offset 3;
在這里插入圖片描述

數(shù)據(jù)完整性:
(1)實(shí)體完整性:表中的每一行數(shù)據(jù)都是唯一的,不能重復(fù)出現(xiàn),通過主鍵(PRIMARYKEY)來實(shí)現(xiàn)。
(2)域(field 字段,列)完整性:每一行必須要符合某種特定的數(shù)據(jù)類型或約束,
非空約束 NOT NULL 該字段不能為空
唯一約束 UNIQUE 該字段不允許重復(fù),允許為空
獲取唯一約束的名字show create table student;
刪除一個(gè)唯一約束 alter table tName drop index name ;
(3)參照完整性:外鍵約束 FOREIGNN KEY,外鍵 是另一張表的主鍵
表已經(jīng)存在的情況下,需要使用alter table tName add constraint fk_1 fGPRRIGNN KEY(s_id) REFERENCES student(id);

數(shù)據(jù)庫的備份和恢復(fù)

數(shù)據(jù)庫的備份在終端下使用命令mysqldump -u root -p 43th>43th.sql
在這里插入圖片描述
恢復(fù)數(shù)據(jù)庫在終端下使用命令mysql -u root -p 43th<43th.sql
或者在mysql>中使用source 43th.sql;相當(dāng)于在當(dāng)前的空數(shù)據(jù)庫下執(zhí)行43th.sql中的sql語句導(dǎo)入數(shù)據(jù)
因?yàn)槲覀儌浞莸臄?shù)據(jù)庫文件中不存在創(chuàng)建數(shù)據(jù)庫的語句,因此我們導(dǎo)入數(shù)據(jù)庫之前因該先創(chuàng)建數(shù)據(jù)庫在進(jìn)行數(shù)據(jù)數(shù)據(jù)的導(dǎo)入

聯(lián)合主鍵
對(duì)某一張表,一條的記錄的唯一性由兩個(gè)或者以上的字段共同決定。
如果是由兩個(gè)字段決定的,只要其中一個(gè)之一不相同,就是一條不同的記錄。只有當(dāng)兩個(gè)字段都相同時(shí),該記錄不能插入到表中

DQL復(fù)雜查詢

連接查詢
針對(duì)多張表
交叉連接(笛卡爾積)[三種寫法操作結(jié)果一致]
select * from letfTable cross join rightTable;
selsct * from leftTable join rightTable;
select * from leftTable,rightTable;

在這里插入圖片描述
內(nèi)連接
關(guān)鍵字inner join (一般都會(huì)加上on選擇條件)
select * from leftTable inner join rightTable on leftTable.id=rightTable.id;
select * from leftTable inner join rightTable on leftTable.id=rightTable.id where leftTable.id>3;
外連接
執(zhí)行左右外連接需要使用on關(guān)鍵字加入選擇條件,如果使用左外連接是,當(dāng)右表中沒有與左表中對(duì)應(yīng)的記錄時(shí),查詢出的右表數(shù)據(jù)全部用NULL代替,左表中的所有數(shù)據(jù)都出現(xiàn);對(duì)于右外連接也是一樣的
左外連接letf outer join
select * from leftTable letfr outer join rightTable on leftTable.id=rightTable;
右外連接right outer join
select * from leftTable letfr outer join rightTable on leftTable.id=rightTable;

子查詢
子查詢也叫嵌套查詢,是指在where子句或from子句中又嵌入select查詢語句(一般寫在where子句)

select * from person where id = (select id from person where id < 4);
select * from (select id,name,chinese from person where name like ‘k%’) as t;

聯(lián)合查詢
聯(lián)合查詢能夠合并兩條查詢語句的查詢結(jié)果,去掉其中重復(fù)數(shù)據(jù)行,然后返回沒有重復(fù)數(shù)據(jù)行的查詢結(jié)果。聯(lián)合查詢使用union關(guān)鍵字

select * from person where chinese > 80 union select * from person where english > 80;

報(bào)表查詢

統(tǒng)計(jì)函數(shù)
cout()計(jì)數(shù)
sum()求和
avg()求平均值
max()最大值
min()最小值
在這里插入圖片描述

select count(*) ,chinsesfrom person group by chinese;//對(duì)chinese中數(shù)值相同的進(jìn)行統(tǒng)計(jì),打印出相同不同數(shù)據(jù)的相同數(shù)量
在這里插入圖片描述

select count(*) ,chinsesfrom person group by chinese having chinses >80;//進(jìn)行分組之后還要對(duì)數(shù)據(jù)進(jìn)行過濾使用having子句,where是在沒有分組之前進(jìn)行過濾,having是在分組之后進(jìn)行過濾
在這里插入圖片描述

http://www.risenshineclean.com/news/66469.html

相關(guān)文章:

  • 自己給自己網(wǎng)站做推廣外鏈發(fā)布平臺(tái)大全
  • 用手機(jī)可以做網(wǎng)站韓國日本比分
  • 用手機(jī)怎么申請(qǐng)免費(fèi)自助網(wǎng)站百度一下下載
  • 外貿(mào)seo站福州整站優(yōu)化
  • 北京網(wǎng)站開發(fā)哪家專業(yè)合肥seo外包平臺(tái)
  • 趙縣網(wǎng)站建設(shè)山東關(guān)鍵詞網(wǎng)絡(luò)推廣
  • 廣西注冊(cè)公司網(wǎng)站凡科網(wǎng)免費(fèi)建站
  • 花多少錢能把網(wǎng)站做到頁面百度收錄提交入口網(wǎng)址
  • 惠州做網(wǎng)站開發(fā)百度網(wǎng)址安全檢測(cè)中心
  • 長春專業(yè)做網(wǎng)站的公司有哪些抖音引流推廣怎么做
  • 網(wǎng)牛網(wǎng)站建設(shè)百度快照怎么發(fā)布
  • 煙臺(tái)seo網(wǎng)站診斷網(wǎng)站點(diǎn)擊量與排名
  • 晉江網(wǎng)站建設(shè)價(jià)格排名優(yōu)化公司哪家靠譜
  • 網(wǎng)站建設(shè)設(shè)計(jì)服務(wù)公司百度網(wǎng)址大全官方網(wǎng)站
  • 旅行網(wǎng)站首頁模板搜索引擎哪個(gè)好用
  • 收費(fèi)的網(wǎng)站如何免費(fèi)線上廣告投放方式
  • 找哪些公司做網(wǎng)站惠州網(wǎng)站seo排名優(yōu)化
  • 做網(wǎng)站怎么那么難寧波網(wǎng)站推廣網(wǎng)站優(yōu)化
  • 電子商務(wù)網(wǎng)站的建設(shè)開發(fā)工具成都高新seo
  • php mysql的網(wǎng)站開發(fā)騰訊企點(diǎn)qq
  • 嘉興seo管理seo深度解析
  • 做app和做網(wǎng)站相同和區(qū)別最新網(wǎng)絡(luò)營銷方式
  • ppt超鏈接到網(wǎng)站怎么做seo網(wǎng)站優(yōu)化多少錢
  • 四川宜賓網(wǎng)站建設(shè)免費(fèi)網(wǎng)站推廣軟件哪個(gè)好
  • 網(wǎng)站怎么做pc導(dǎo)流頁銅陵seo
  • 網(wǎng)站建設(shè)官方商城每日一則小新聞
  • 代做動(dòng)畫畢業(yè)設(shè)計(jì)的網(wǎng)站seo頁面鏈接優(yōu)化
  • 韶關(guān)做網(wǎng)站公司重慶百度seo代理
  • 自學(xué)設(shè)計(jì)的網(wǎng)站百度推廣網(wǎng)站
  • 公司設(shè)計(jì)網(wǎng)站需要注意哪些qq推廣引流網(wǎng)站