Assignment2

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

1) JOIN EMPLOYEE , DEPT AND SALARY TABLE to extract the information - emp_id ,

emp_name , dept_id , dept_name , salary

SELECT e.E_ID,e.F_Name,d.Dept_ID,d.Dept_Name,s.Total_Salary FROM


employee_01 e
JOIN
Dept d ON e.Dept_ID = d.Dept_ID
JOIN
Salary_01 s ON e.E_ID = s.E_ID;

2)extract the customer data - customer_id , customer_name , Order_id , Order_date ,


Customer_address , Product_detail

SELECT
c.Cust_ID,
c.F_Name,
o.Order_ID,
o.Order_Date,
FROM
Customer c
JOIN
Customer_address ca ON c.Cust_ID = ca.Cust_ID
JOIN
Order1 o ON c.Cust_ID = o.Cust_ID;

3)write a sql query to list class teacher of all students

SELECT
s.Stud_ID,
s.F_Name,
t.Address_ID,
t.F_Name
FROM
Student s
JOIN
Teacher t ON s.Address_ID = t.Address_ID;

4)write a sql query to get a result of student like - student_id , student_name ,


student_class , Subject , Marks

SELECT
s.Stud_ID,
s.F_Name,
c.Class_Name,
sub.Sub_Name,
m.Marks
FROM
Student s
JOIN
class c ON sub.Class_ID = c.Class_ID
JOIN
Marks m ON s.Stud_ID = m.Stud_ID
JOIN
Subject sub ON m.Sub_ID = sub.Sub_ID;

7)write a sql query to get detail of tkt availibility in all trains

SELECT
t.Train_ID,
t.Train_Name,
t.Train_Type,
a.Avail_seats,
a.A_Date
FROM
Train_info t
JOIN
Available a ON t.Train_ID = a.Train_ID;

6)write a sql query to get the info of all hotel rooms which are not booked

SELECT
hr.Room_ID,
hr.HotelID,
hr.Room_Type,
hr.R_Price,
FROM
Hotel_room hr
LEFT JOIN
Booking_info bi ON hr.Room_ID = bi.Room_ID;

You might also like