資料庫 Mysql內容補充二

來源:互聯網
上載者:User

標籤:name   rac   ora   rom   欄位名   pre   span   sel   內串連   

多表查詢mysql支援的是SQL99標準的串連查詢,並不支援oracle公司的外串連查詢,但是支援oracle等值查詢,不等值查詢,自串連查詢,子查詢(只要不是外串連(+)都支援)oracle也支援SQL99標準的串連查詢
內串連--等值查詢select e.empno,e.ename,e.sal,d.dname from emp einner join dept don e.deptno=d.deptno;--簡單而言:就是將oracle多表查詢文法中的逗號換成inner join,  where中的查詢條件放在on後面,強調on後面不單單可以是串連條件也可以是查詢條件--不等值查詢select e.empno,e.ename,e.sal,s.gradefrom emp einner join salgrade son e.sal>=s.losal and e.sal<=s.hisal;左外串連(右外串連--right join)select d.deptno,d.dname,count(e.empno)from dept dleft join emp eon d.deptno=e.deptnogroup by d.deptno, d.dname--左外串連要注意,想全部顯示那個表的資料,就把那個表作為基表,  例如想顯示dept表中的40號部門,所以dept就是基表,這個oracle中的(+)相反。
mysql中的濾空函數--ifnull(欄位名,想要的值)--mysql沒有nvl()函數
mysql中的字串串連--mysql不支援oracle中的"||"串連符號--mysql支援oracle中的concat()串連函數

 

資料庫 Mysql內容補充二

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.