0% found this document useful (0 votes)
2 views

SQL_Join

SQL Join

Uploaded by

Pratiksha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

SQL_Join

SQL Join

Uploaded by

Pratiksha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

You have two tables:

Orders

order_i customer_ amou


d id nt

1 101 500

2 102 300

3 103 700

4 105 900

Customers

customer_ customer_na
city
id me

New
101 John
York

102 Alice London

104 Bob Toronto

1. Write an SQL query to fetch only the customers who have


placed an order, displaying customer name and order amount.

2. Write an SQL query to fetch all orders and the corresponding customer names. If
an order has no customer, display NULL for customer name.

You have two tables:

Employees

emp_id emp_name dept_id salary


1 John 101 60000
2 Alice 102 75000
3 Bob 103 50000
4 David 104 80000
5 Emma NULL 45000

Departments

dept_id dept_name location


101 HR New York
dept_id dept_name location
102 IT London
103 Finance Toronto
105 Marketing Sydney

Write an SQL query to fetch all employees along with their department
names. If an employee does not belong to any department, show "No
Department".

You might also like