幾個(gè)SELECT語句的題目 求助.. 完整的最佳答案160分 SQL select語句問題,怎么用select出來的結(jié)果作...
1.找出座位數(shù)在100以上的航班(Aircraft, Noseats), 請(qǐng)列出其航班號(hào)(Flight, FlightNo), 飛機(jī)型號(hào)描述(Aircraft, Adescription), 起飛機(jī)場(chǎng)(Flight, FromAirport)及目的地機(jī)場(chǎng)(Flight,ToAirport)
答:select flightono,aircrafttype,fromairport,toairport from flight where AircraftType in (select aircrafttype from aircraft where noseats>100)
2.從行程信息(Itinerary)中找出目的地機(jī)場(chǎng)(Flight,ToAirport)為COV的航班, 列出其航班號(hào)(Itinerary, FlightNo),起飛日期(Itinerary, FlightDate)
答:select flightno,flightdate from itinerary where flightno in (select flightno from Flight where toairport='COV')
3.按照字母順序排列, 找出可以起降A(chǔ)TP(Aircraft, AircraftType)型號(hào)飛機(jī)的機(jī)場(chǎng)(Airport)
答:select airport from airport where airport in (select fromairport from flight where fromairport='ATP') or airport in (select toairport from flight where toairport='ATP') order by airport asc
4.列出2004年8月11日(11/8/2004 FlightDate)所有機(jī)票的票價(jià)(Ticket)
答:select price from tariff where faretype in (select faretype from itinerary where flightdate between'10/8/2004'and'12/8/2004')
5.列出在凌晨1點(diǎn)(01:00 am Flight, DepTime)至凌晨5點(diǎn)30分(05:30 am Flight, DepTime)之間, 沒有任何飛機(jī)起飛的機(jī)場(chǎng)(Airport)
答:select airport from airport where airport in (select fromairport from flight where left(right(convert(char,deptime,9),7),2))='am' and convert(char,deptime,8)>'01:00' and convert(char,deptime,8)<'05:30')
6.列出所有買了至少兩張機(jī)票(Ticket 每?jī)蓮埰?80英鎊,單位符號(hào)為 £ )的乘客(Passenger)
答:select name from passenger where pid in (select p from (select pid as p,count(*) as c from ticket group by pid having count(*) >1) as tic)
多啊 才160?不答
喬毓15316565739: SQL中有哪些select語句查詢數(shù)據(jù) -
思明區(qū)萬向: ______ select * from table order by num desc
喬毓15316565739: 關(guān)于SQL的多個(gè)SELECT問題 -
思明區(qū)萬向: ______ select 日期,姓名,sum(支出), sum(case 時(shí)間 when 18 then 支出else 0 end) from xiangxi group by 日期,姓名 select 日期,sum(支出), max(支出) from xiangxi group by 日期
喬毓15316565739: SQL 查詢 3個(gè)SELECT語句 怎么合并一個(gè)
思明區(qū)萬向: ______ declare @startdate datetime,@enddate datetime set @startdate = '2011-05-10' set @enddate = '2011-09-11' SELECT wait.people AS '等待人數(shù)',endPeople.people AS '辦理完成人數(shù)',work.people AS '正在辦理人數(shù)' FROM (select count(wId) ...
喬毓15316565739: 求一個(gè)select語句 - 技術(shù)問答
思明區(qū)萬向: ______ select c.attr_value from ecs_goods_attr c where c.goods_id in (select a.goods_id from ecs_goods a where a.goods_name=\'s020039\') and c.attr_value != \'apson\';
喬毓15316565739: 最簡(jiǎn)單的select語句問題???
思明區(qū)萬向: ______ 書本害人不淺,好幾本書上都寫的where name="you want",用的是雙引號(hào)!感謝各位!
喬毓15316565739: 求一條SELECT語句:現(xiàn)有A,B兩表,A:有兩行兩列,B有三行兩列,查詢后,出來的是3行4列,左邊兩列是A的內(nèi)容,右邊兩列是B的內(nèi)容,這不是笛卡爾集,可能第三行的左邊兩列顯示為NULL,兩個(gè)表無關(guān)系 -
思明區(qū)萬向: ______ SELECT T1.COL1,T1.COL2,T2.COL1,T2.COL2 FROM 表1 T1,表2 T2
喬毓15316565739: 三個(gè)表t1、t2、t3如下,求SQL的select 語句 -
思明區(qū)萬向: ______ select a.id ,[as] ,as+isnull(bl,0)-isnull(cs,0) ,al-isnull(cl,0) from (select id,sum([as]) [as],sum(al) al as from t1 group by id) a left join (select id,sum(bs) bs,sum(bl) al as from t2 group by id) b on a.id=b.id left join (select id,sum(cs) cs,sum(cl) cl as from t3 group by id) c on a.id=c.id
答:select flightono,aircrafttype,fromairport,toairport from flight where AircraftType in (select aircrafttype from aircraft where noseats>100)
2.從行程信息(Itinerary)中找出目的地機(jī)場(chǎng)(Flight,ToAirport)為COV的航班, 列出其航班號(hào)(Itinerary, FlightNo),起飛日期(Itinerary, FlightDate)
答:select flightno,flightdate from itinerary where flightno in (select flightno from Flight where toairport='COV')
3.按照字母順序排列, 找出可以起降A(chǔ)TP(Aircraft, AircraftType)型號(hào)飛機(jī)的機(jī)場(chǎng)(Airport)
答:select airport from airport where airport in (select fromairport from flight where fromairport='ATP') or airport in (select toairport from flight where toairport='ATP') order by airport asc
4.列出2004年8月11日(11/8/2004 FlightDate)所有機(jī)票的票價(jià)(Ticket)
答:select price from tariff where faretype in (select faretype from itinerary where flightdate between'10/8/2004'and'12/8/2004')
5.列出在凌晨1點(diǎn)(01:00 am Flight, DepTime)至凌晨5點(diǎn)30分(05:30 am Flight, DepTime)之間, 沒有任何飛機(jī)起飛的機(jī)場(chǎng)(Airport)
答:select airport from airport where airport in (select fromairport from flight where left(right(convert(char,deptime,9),7),2))='am' and convert(char,deptime,8)>'01:00' and convert(char,deptime,8)<'05:30')
6.列出所有買了至少兩張機(jī)票(Ticket 每?jī)蓮埰?80英鎊,單位符號(hào)為 £ )的乘客(Passenger)
答:select name from passenger where pid in (select p from (select pid as p,count(*) as c from ticket group by pid having count(*) >1) as tic)
多啊 才160?不答
相關(guān)評(píng)說:
思明區(qū)萬向: ______ select * from table order by num desc
思明區(qū)萬向: ______ select 日期,姓名,sum(支出), sum(case 時(shí)間 when 18 then 支出else 0 end) from xiangxi group by 日期,姓名 select 日期,sum(支出), max(支出) from xiangxi group by 日期
思明區(qū)萬向: ______ declare @startdate datetime,@enddate datetime set @startdate = '2011-05-10' set @enddate = '2011-09-11' SELECT wait.people AS '等待人數(shù)',endPeople.people AS '辦理完成人數(shù)',work.people AS '正在辦理人數(shù)' FROM (select count(wId) ...
思明區(qū)萬向: ______ select c.attr_value from ecs_goods_attr c where c.goods_id in (select a.goods_id from ecs_goods a where a.goods_name=\'s020039\') and c.attr_value != \'apson\';
思明區(qū)萬向: ______ 書本害人不淺,好幾本書上都寫的where name="you want",用的是雙引號(hào)!感謝各位!
思明區(qū)萬向: ______ SELECT T1.COL1,T1.COL2,T2.COL1,T2.COL2 FROM 表1 T1,表2 T2
思明區(qū)萬向: ______ select a.id ,[as] ,as+isnull(bl,0)-isnull(cs,0) ,al-isnull(cl,0) from (select id,sum([as]) [as],sum(al) al as from t1 group by id) a left join (select id,sum(bs) bs,sum(bl) al as from t2 group by id) b on a.id=b.id left join (select id,sum(cs) cs,sum(cl) cl as from t3 group by id) c on a.id=c.id