Home > database >  SQL small white ask related questions, thank you!!!!!!
SQL small white ask related questions, thank you!!!!!!

Time:11-01

Membership rosters (member mash, name, remaining mileage)
On CV (member mash, date, aviation)
On booking (member mash, date, aviation)

1, for the rest of the range for more than 50000 members of the corps

Select members mash, remaining mileage
The from membership rosters
Where the rest of the range & gt;=50000;

2 please call a member of the central aso name on all the airlines

Select members mash, airline name
The from on CV
Where members mash in (
Select the member mash
The from membership rosters
Where name='central aso'
);

3 o already on or have been booking CU001 airlines member of mash

Select distinct member mash
The from on CV
Where members mash in (
Select the member mash
The from on reservation
Air where name='CU001'
);

4 for all members of the residual mileage average

Select members mash, avg (residual mileage) as the average residual mileage
The from membership rosters
Group by member mash;

5 what is in the table above shows the external keywords

Member mash


Bother the great spirit guide have what problem, thank you very much!!!!!!!!!!

CodePudding user response:

2, 3 should be with the union

CodePudding user response:

2, you can modify, replace nested with the join query
Select b. member mash, B carrier name
The from take history AS A
Join the member list AS B ON a. member mash=b. mash
Where A. Name='central aso'

3, can be modified with 2, but there is one problem is a must to make an appointment for just can have on a resume? If it is, according to two good; If not, may be from the two tables corps UNION members

CodePudding user response:

reference 1st floor shoppo0505 response:
2, 3 should use the union
thank you!

CodePudding user response:

refer to the second floor chenghangstar response:
2, you can modify, replace nested with the join query
Select b. member mash, B carrier name
The from take history AS A
Join the member list AS B ON a. member mash=b. mash
Where A. Name='central aso'

3, can be modified with 2, but there is one problem is a must to make an appointment for just can have on a resume? If it is, according to two good; If not, may be from the two tables UNION members to our
should be first to make an appointment to have a resume, thank you! trouble
  • Related