查詢(xún)mysql數(shù)據(jù)庫(kù)表單和使用函數(shù)介紹

下文主要給大家?guī)?lái)查詢(xún)MySQL數(shù)據(jù)庫(kù)表單和使用函數(shù),希望這些內(nèi)容能夠帶給大家實(shí)際用處,這也是我編輯查詢(xún)mysql數(shù)據(jù)庫(kù)表單和使用函數(shù)這篇文章的主要目的。好了,廢話(huà)不多說(shuō),大家直接看下文吧。

創(chuàng)新互聯(lián)憑借在網(wǎng)站建設(shè)、網(wǎng)站推廣領(lǐng)域領(lǐng)先的技術(shù)能力和多年的行業(yè)經(jīng)驗(yàn),為客戶(hù)提供超值的營(yíng)銷(xiāo)型網(wǎng)站建設(shè)服務(wù),我們始終認(rèn)為:好的營(yíng)銷(xiāo)型網(wǎng)站就是好的業(yè)務(wù)員。我們已成功為企業(yè)單位、個(gè)人等客戶(hù)提供了網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)服務(wù),以良好的商業(yè)信譽(yù),完善的服務(wù)及深厚的技術(shù)力量處于同行領(lǐng)先地位。

單表查詢(xún)

準(zhǔn)備一張雇員表company.employee

雇員編號(hào) emp_id   int

雇員姓名 emp_name  varchar(30)

雇員性別 sex  enum

雇用日期 hire_date  date

職位  post  varchar(50)

職位描述 job_description  varchar(50)

薪水 salary double(15,2)

辦公室office int

部門(mén)編號(hào) dep_id int

 查詢(xún)mysql數(shù)據(jù)庫(kù)表單和使用函數(shù)介紹

一、表的簡(jiǎn)單查詢(xún)

Select * from employee;  //查看全部

Select 字段1,字段2,...字段n from表名

避免重復(fù)關(guān)鍵字distinct

Select distinct post from employee

關(guān)系運(yùn)算符:+ - * 、%

Select emp_name salary*12 from employee;

As別名

Select emp_name as姓名salary*12 as薪水from employee;

定義顯示格式 concat()函數(shù)用于連接字符串

Select concat (emp_name,’annual salary’ ,salary*12) as 員工年薪

 From employee; 

二、通過(guò)條件查詢(xún)

條件查詢(xún)條件表達(dá)式

比較運(yùn)算符:> <= != >= <=

邏輯運(yùn)算符and 或者&&  or或者||  xor  not或者!

語(yǔ)法:select 字段1,字段2,字段N from表名  where condition(條件表達(dá)式)

單條件查詢(xún)

Select emp_name from employee where post =’hr’

多條件查詢(xún)

Select emp_name from employee where post=’hr’ and salayr>100000;

關(guān)鍵字查詢(xún)between and     

Select emp_name from employee

Where salary between 5000 and 15000;  //工資在5000到15000之間

Select emp_name from employee

Where salary  not  between 5000 and 15000; //  工資不在5000到15000之間的人

關(guān)鍵字查詢(xún)is  null

Select emp_name,job_description from employee

Where job_description is  null; // 查看職位描述是空的員工

Select emp_name,job_description from employee

Where job_description is not null; //查看職位描述非空的員工

 對(duì)于以上關(guān)于查詢(xún)mysql數(shù)據(jù)庫(kù)表單和使用函數(shù),大家是不是覺(jué)得非常有幫助。如果需要了解更多內(nèi)容,請(qǐng)繼續(xù)關(guān)注我們的行業(yè)資訊,相信你會(huì)喜歡上這些內(nèi)容的。

當(dāng)前標(biāo)題:查詢(xún)mysql數(shù)據(jù)庫(kù)表單和使用函數(shù)介紹
文章URL:http://www.muchs.cn/article38/ihpisp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、動(dòng)態(tài)網(wǎng)站、網(wǎng)站收錄、定制開(kāi)發(fā)移動(dòng)網(wǎng)站建設(shè)、定制網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁(yè)設(shè)計(jì)公司