Home » Performance » MySQL » MySQL functions
MySQL functions [message #3723] Thu, 20 November 2008 05:06
aloxy  is currently offline aloxy
Messages: 1
Registered: November 2008
Location: Uganda
Junior Member
who can bail me out with a code hat produces a result to the following question?

Return a list of all flights along with their current un-discounted price

according to these tables;

CREATE TABLE `fly-four-less`.`flight_profiles` (
`FLP_ID` decimal(8,0) NOT NULL default '0',
`FLT_NUMB` decimal(4,0) default NULL,
`SEATS` int(11) default NULL,
`PRICE_CODE` varchar(50) default NULL,
`from` varchar(50) default NULL,
`to` varchar(50) default NULL,
`MON` varchar(1) default NULL,
`TUE` varchar(1) default NULL,
`NEXT_DAY` int(11) default NULL,
`WED` varchar(1) default NULL,
`THU` varchar(1) default NULL,
`FRI` varchar(1) default NULL,
`SAT` varchar(1) default NULL,
`SUN` varchar(1) default NULL,
`depart` datetime default NULL,
`arrive` datetime default NULL,
PRIMARY KEY (`FLP_ID`),
UNIQUE KEY `FLT_NUMB` (`FLT_NUMB`),
KEY `FK_flight_profiles_1` (`from`),
KEY `FK_flight_profiles_2` (`to`),
CONSTRAINT `flight_profiles_ibfk_1` FOREIGN KEY (`from`) REFERENCES `airports` (`IATA_CODE`),
CONSTRAINT `flight_profiles_ibfk_2` FOREIGN KEY (`to`) REFERENCES `airports` (`IATA_CODE`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `fly-four-less`.`price` (
`PC_ID` int(11) NOT NULL default '0',
`PC_LEVEL` int(11) default NULL,
`PRICE` int(11) default NULL,
`FROM_DATE` datetime default NULL,
`TO_DATE` datetime default NULL,
PRIMARY KEY (`PC_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `fly-four-less`.`discount` (
`DIS_ID` int(11) NOT NULL default '0',
`DAYS_ADV_MIN` int(11) default NULL,
`DAYS_ADV_MAX` int(11) default NULL,
`PASSENGER_TYPE` int(11) default NULL,
`DISCOUNT` int(11) default NULL,
PRIMARY KEY (`DIS_ID`),
KEY `FK_discount_1` (`PASSENGER_TYPE`),
CONSTRAINT `discount_ibfk_1` FOREIGN KEY (`PASSENGER_TYPE`) REFERENCES `person_type` (`PT_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

i came up with the following lines of query, but its not the results, if help avails can i have a deeper explanation on how the query digs to the table(s)?

SELECT * FROM FLIGHT_PROFILES F
WHERE F.NEXT_DAY=0;

Aloys
Previous Topic:How to retrieve Images from Outlook contacts(PST file) ?
Next Topic:Random user search
Goto Forum:
  


Current Time: Sun Jul 5 17:26:48 EDT 2009

Total time taken to generate the page: 0.01137 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.