如何在持续时间成本表中增加每个酒店和航班的费用 [英] How to add cost per hotel and flight in duration cost table

查看:67
本文介绍了如何在持续时间成本表中增加每个酒店和航班的费用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题



如何获得每个酒店和航班的费用,然后根据航班日期自动将其添加到持续时间成本表中?



详情



假设我写航班日期



26/07/2017 alexia 8days 04/08/2017



必须自动从酒店价格表和航班价格中获取费用



然后在持续时间成本表中添加它



这样



我写的查询获得成本每个酒店和航班写的航班日期然后插入



它到持续时间成本表我的数据库



< pre lang =SQL> CREATE TABLE 程序(
ProgramID int primary key not not not null
Pr ogramName varchar 30

GO
插入 进入程序 1 ' Alexia '),( 2 ' Amon '),( 3 ' Sfinx '
GO
CREATE TABLE ProgramDuration(
DurationNo int primary null
progra mID int null
持续时间 varchar 30 null

插入 进入 ProgramDurationvalues( 1 1 ' 3 for Alexia '),( 2 1 ' 5 for Alexia'
GO
CREATE TABLE DurationDetail(
DurationNo int < span class =code-keyword> not null
[Days] varchar 20 null
HotelID int null
FlightID < span class =code-keyword> int null

insert into DurationDetail values 2 ' Day1' 1 ,< span class =code-string>' amsterdam to luxor'' airport to hotel'),( 2 ' Day2' 1 null ,< span class =代码字符串>' AbuSimple musuem'),
2 ' Day3' 1 null ),
2 ' Day4' 1 null ) ,
2 ' Day5' 1 ' 卢克索到阿姆斯特丹'
GO
CREATE TABLE DurationCost(
DurationNo int null
[日期] date null
Hote_cost numeric 18 0 null
Flight_cost numeric 18 0 null
Transfer_cost 数字 18 0 null

insert into DurationCostvalues(
2 ' 2017-06-25' 25 500 20 ),
2 ' 2017-06-26' 25 null 55 ),
2 ' 2017-06-27' 25 null null ),
2 ' 2017-06-28' 25 null null ),
2 ' 2017-06-29' 25 500 null
GO
CREATE TABLE [dbo]。[FlightData](
[FlighID] [ nvarchar ]( 50 NOT NULL
[FlightNo] [ nvarchar ]( 50 NOT NULL
[FlightDate] [ datetime ] NULL
[FlightTypeID] [ int ] NULL
[AirLine] [ nvarchar ]( 50 NULL
[到达] [时间]( 7 NULL
[出发] [时间]( 7 NULL
[Price] [ money ] NULL
[有效] [位<​​/ span>] NULL

插入 FlightData 1 ' ms300' 1 ' egyptairline'' < span class =code-string> 6'' 10' 200 1
创建 < span class =code-keyword > TABLE
[dbo]。[FlightRoute](
[FlightTypeID] [ int ] NOT NULL
[FlightFrom] [ nvarchar ](max) NULL
[FlightTo] [ nvarchar ](max) NULL
[有效] [位<​​/ span>] NULL
[ FlightRouteWay] [ nvarchar ](max) NULL

插入 进入 FlightRoute 1 ' amsterdam'' cairo' 1 ,amsterdam to cairo),( 2 ' cairo'' amsterdam' 1 ,cairo to amsterdam)
创建 [dbo]。[酒店](
[ProductID] [ int ] NOT NULL
[ProductName] [ nvarchar ]( 50 NULL

插入 进入酒店 1 ' Hilton'),( 2 ' Movenpick'
CREATE TABLE [dbo]。[HotelPrice](
[ProductPriceID] [ int ] NOT NULL
[ProductID] [ int ] NULL
[FromDate] [ datetime ] NULL
[ToDate] [ datetime ] NULL
[HotelPrice] [数字]( 18 0 NULL

insert into HotelPrice 1 1 ,01/07 / 2017,01-09- 2017,20 $),( 2 1 ,02-09-2017,02-11-2017 , 30





我的尝试:



如何在持续时间成本表中增加每个酒店和航班的费用

解决方案

),( 2 1 ,02-09-2017,02-11-2017, 30





我尝试过:



如何在持续时间成本表中增加每家酒店和航班的费用


已经有74个问题和3次这个问题。

如果没有人回答这个问题,那么有一个原因可能是帮助者厌倦了帮助你解决这么多问题,也许他们认为现在是时候自己学习东西了。

引用:

如何获得每个酒店和航班的费用,然后根据航班日期自动将其添加到持续时间成本表中?



第一步:您需要学习和理解数据库设计和SQL。

第二步;用你的大脑。



我们不做你的家庭工作。

HomeWork不会测试你的技能,乞求别人做你的工作,它旨在让你思考并帮助你的老师检查你对你所学课程的理解,以及你应用它们时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。



作为程序员,您的工作是创建算法解决特定问题,你不能依赖别人永远为你做,所以有一段时间你必须学会​​如何。而且越快越好。

当你要求解决方案时,就像试图通过培训其他人来学习开车一样。

创建算法基本上是找到数学并做出必要的调整以适应你的实际问题。



发展的概念就像这个词所暗示的那样:系统地使用科学和满足特定目标或要求的技术知识。 BusinessDictionary.com [ ^ ]

这与有一个不一样快速谷歌并放弃,如果我找不到正确的代码。


problem

How to get cost per hotel and flight then add it in duration cost table based on flight date automatically ?

Details

suppose i write flight date

26/07/2017 alexia 8days 04/08/2017

it must automatically get cost from hotel price table and price from flight

then add it in duration cost table

so that

what query i write to get cost per hotel and flight when write flight date then insert

it to duration cost table my database

CREATE TABLE program(
     ProgramID int primary key not null, 
    ProgramName varchar(30)
     ) 
    GO
     insert into program values(1,'Alexia'),(2,'Amon'),(3,'Sfinx') 
    GO
    CREATE TABLE ProgramDuration(
    DurationNo int primary key not null,
    programID int not null,
    Duration varchar(30) null
    )
    insert into ProgramDurationvalues(1,1,'3 for Alexia'),(2,1,'5 for Alexia')
    GO
    CREATE TABLE DurationDetail(
     DurationNo int not null,
     [Days]  varchar(20) not null, 
    HotelID int null,
     FlightID int null
    )
     insert into DurationDetail values (2,'Day1',1,'amsterdam to luxor','airport to hotel'), (2,'Day2',1,null,'AbuSimple musuem'), 
    (2,'Day3',1,null), 
    (2,'Day4',1,null),
     (2,'Day5',1,'Luxor to amsterdam') 
    GO
    CREATE TABLE DurationCost(
    DurationNo int not null,
    [Date] date not null,
    Hote_cost numeric(18,0) null,
    Flight_cost numeric(18,0) null,
    Transfer_cost numeric(18,0) null
    )
    insert into DurationCostvalues(
    2,'2017-06-25',25,500,20),
    (2,'2017-06-26',25,null,55),
    (2,'2017-06-27',25,null,null),
    (2,'2017-06-28',25,null,null),
    (2,'2017-06-29',25,500,null)
    GO
    CREATE TABLE [dbo].[FlightData](
        [FlighID] [nvarchar](50) NOT NULL,
        [FlightNo] [nvarchar](50) NOT NULL,
        [FlightDate] [datetime] NULL,
        [FlightTypeID] [int] NULL,
        [AirLine] [nvarchar](50) NULL,
        [Arrival] [time](7) NULL,
        [Departure] [time](7) NULL,
        [Price] [money] NULL,
        [Active] [bit] NULL
    )
      insert into FlightData values (1,'ms300',1,'egyptairline','6','10',200,1)
    CREATE TABLE [dbo].[FlightRoute](
        [FlightTypeID] [int] NOT NULL,
        [FlightFrom] [nvarchar](max) NULL,
        [FlightTo] [nvarchar](max) NULL,
        [Active] [bit] NULL,
        [FlightRouteWay] [nvarchar](max) NULL,
    )
    insert into FlightRoute values (1,'amsterdam','cairo',1,amsterdam to cairo), (2,'cairo','amsterdam',1,cairo to amsterdam)
    CREATE TABLE [dbo].[Hotel](
        [ProductID] [int] NOT NULL,
        [ProductName] [nvarchar](50) NULL,
     )
     insert into Hotel values (1,'Hilton'), (2,'Movenpick')
    CREATE TABLE [dbo].[HotelPrice](
        [ProductPriceID] [int] NOT NULL,
        [ProductID] [int] NULL,
        [FromDate] [datetime] NULL,
        [ToDate] [datetime] NULL,
        [HotelPrice] [numeric](18, 0) NULL,
    )
insert into HotelPrice values (1,1,01/07/2017,01-09-2017,20$), (2,1,02-09-2017,02-11-2017,30)



What I have tried:

How to add cost per hotel and flight in duration cost table

解决方案

), (2,1,02-09-2017,02-11-2017,30)



What I have tried:

How to add cost per hotel and flight in duration cost table


Already 74 questions and 3 times this one.
If no one answer this, there is a reason, may be helpers are fed-up helping you on so many questions and may be they think it is time to learn things yourself.

Quote:

How to get cost per hotel and flight then add it in duration cost table based on flight date automatically ?


First step: you need to learn and understand database design and SQL.
second step; use your brain.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.

The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".


这篇关于如何在持续时间成本表中增加每个酒店和航班的费用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆