Given the following relational schema below, write an appropriate SQL expression
ID: 3835260 • Letter: G
Question
Given the following relational schema below, write an appropriate SQL expressions to satisfy each query Employee (Emp No, Name, Salary) Flight (Num, Orign, Dest, Dep_Time, Arr_Time) Departure (Dep_Date, Num) Can_Fly (Emp_No, Model_No) Find out the names of employees who earn more than $120,000 Salary. Find out the average employee salary. Find out all the flight numbers that fly from JFK to LAX with arrive time in between 1 pm to 6pm. (13:00 to 18:00) Find out all the employee names who can fly B-747.Explanation / Answer
1. select name from employee where salary>120000;
here we are selecting the names grater then salary 120000
2. select avg(salary) from employee;
The avg() give the average salary from employee
3.select num from flight where origin="JFK" and dest="LAX" and arr_time between '13:00' and '18:00';
in the abow query we are giving three conditons and this conditons are satisfing rows will return
4, select emp_name from employee inner join can_fly on emp_name.emp_no=can_fly.emp_no where can_fly.model_no="B-747";
here we are using inner join to write the query we are joining two tables and given one condion on the joined table if the codion satisfing rows wil return