下文主要給大家?guī)聿樵僊ySQL數(shù)據(jù)庫表單和使用函數(shù),希望這些內(nèi)容能夠帶給大家實(shí)際用處,這也是我編輯查詢mysql數(shù)據(jù)庫表單和使用函數(shù)這篇文章的主要目的。好了,廢話不多說,大家直接看下文吧。
創(chuàng)新互聯(lián)憑借在網(wǎng)站建設(shè)、網(wǎng)站推廣領(lǐng)域領(lǐng)先的技術(shù)能力和多年的行業(yè)經(jīng)驗(yàn),為客戶提供超值的營銷型網(wǎng)站建設(shè)服務(wù),我們始終認(rèn)為:好的營銷型網(wǎng)站就是好的業(yè)務(wù)員。我們已成功為企業(yè)單位、個(gè)人等客戶提供了網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)服務(wù),以良好的商業(yè)信譽(yù),完善的服務(wù)及深厚的技術(shù)力量處于同行領(lǐng)先地位。
準(zhǔn)備一張雇員表company.employee
雇員編號 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
部門編號 dep_id int
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;
條件查詢條件表達(dá)式
比較運(yùn)算符:> <= != >= <=
邏輯運(yùn)算符and 或者&& or或者|| xor not或者!
語法:select 字段1,字段2,字段N from表名 where condition(條件表達(dá)式)
單條件查詢
Select emp_name from employee where post =’hr’
多條件查詢
Select emp_name from employee where post=’hr’ and salayr>100000;
關(guā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)鍵字查詢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; //查看職位描述非空的員工
對于以上關(guān)于查詢mysql數(shù)據(jù)庫表單和使用函數(shù),大家是不是覺得非常有幫助。如果需要了解更多內(nèi)容,請繼續(xù)關(guān)注我們的行業(yè)資訊,相信你會喜歡上這些內(nèi)容的。
當(dāng)前標(biāo)題:查詢mysql數(shù)據(jù)庫表單和使用函數(shù)介紹
文章URL:http://aaarwkj.com/article38/ihpisp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)、動態(tài)網(wǎng)站、網(wǎng)站收錄、定制開發(fā)、移動網(wǎng)站建設(shè)、定制網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)