Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore Introduction to SQL

Introduction to SQL

Published by Siripan Saetim, 2022-09-26 04:21:38

Description: Introduction to SQL

Keywords: basic sql,sql

Search

Read the Text Version

ทดลองทา: ตอ้ งการ left outer join ตาราง product กับ categories (แสดงข้อมูล) คาตอบ แต่ละประเภท มีสนิ ค้าอะไรบา้ ง ?? 51

Right outer join 52

ตวั อยา่ ง right outer join ในตาราง customers กบั orders customers right outer join orders on ตำรำงแรก => customers orders.cust_id = customers.cust_id ตำรำงสดุ ท้ำย => orders ข้อมูลทกุ แถวในตำรำงสดุ ท้ำย ตอ้ งนำมำแสดงทง้ั หมด 53

ตัวอย่าง right outer join ในตาราง employee กบั orders employees right outer join orders on employees.emp_id = orders.emp_id ตำรำงแรก => employees ตำรำงสุดทำ้ ย => orders 54

ตัวอย่าง right outer join ในตาราง customers กบั orders (แสดงข้อมลู ) ลูกค้าแต่ละคนมีใบส่งั ซือ้ มั้ย?? select order_id, company_name หมายเลขอะไรบ้าง?? from orders right outer join customers on orders.cust_id = customers.cust_id 55

ทดลองทา: ตอ้ งการ right outer join ตาราง product กับ categories (แสดงข้อมลู ) คาตอบ แตล่ ะประเภท มีสนิ ค้าอะไรบา้ ง ?? 56

คาถาม ใหท้ ดลอง Query ตามความต้องการตอ่ ไปน้ี - ใหแ้ สดงชื่อพนักงำนและเลข ใบสัง่ ซื้อ รวมท้งั พนกั งำนท่ไี ม่เคย ออกใบส่งั ซอื้ ด้วยวธิ ี left join คาตอบ 57

คาถาม ให้ทดลอง Query ตามความต้องการตอ่ ไปนี้ - ให้แสดงชอื่ พนักงำนและ เลขใบสงั่ ซ้อื รวมทงั้ พนกั งำน ที่ไมเ่ คยออกใบส่งั ซอื้ ดว้ ยวธิ ี right join คาตอบ 58

Questions? SQL : Structure query language A S ST.PROF. S IR IPA N SA E T IM

โครงสร้างความสมั พนั ธ์ของตารางในฐานขอ้ มูล (ER-diagram)

ขอ้ มูลในแตล่ ะตาราง

ขอ้ มูลในแตล่ ะตาราง

63

https://online.pubhtml5.com/borh/ieqk/ Introduction to SQL SQL : Structure query language A S ST.PROF. S IR IPA N SA E T IM


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook