Sei sulla pagina 1di 8

---------

phpMyAdmin SQL Dump


version 3.2.4
http://www.phpmyadmin.net
Host: localhost
Generation Time: Feb 17, 2013 at 05:37 PM
Server version: 5.1.41
PHP Version: 5.3.1

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101
/*!40101
/*!40101
/*!40101

SET
SET
SET
SET

@OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
NAMES utf8 */;

--- Database: `2011C6PS624G`


--- ---------------------------------------------------------- Table structure for table `booking`
-CREATE TABLE IF NOT EXISTS `booking` (
`PNR` varchar(30) NOT NULL,
`traincode` varchar(20) NOT NULL,
`class` varchar(20) NOT NULL,
`date_of_booking` date NOT NULL,
`source_station` varchar(10) NOT NULL,
`destination_station` varchar(10) NOT NULL,
`date_of_boarding` date NOT NULL,
`fare` decimal(10,2) NOT NULL,
`coach_no` varchar(2) NOT NULL,
`no_of_seats` int(11) NOT NULL,
PRIMARY KEY (`PNR`),
KEY `train code` (`traincode`),
KEY `class` (`class`),
KEY `source station` (`source_station`),
KEY `destination station` (`destination_station`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `booking`
-INSERT INTO `booking` (`PNR`, `traincode`, `class`, `date_of_booking`, `source_s
tation`, `destination_station`, `date_of_boarding`, `fare`, `coach_no`, `no_of_s
eats`) VALUES
('101', '16345', 'secondac', '2013-02-21', 'TNA', 'MAO', '2013-03-01', '0.00', '
B1', 4),
('102', '12620', 'secondac', '2013-02-27', 'MAO', 'CSTM', '2013-03-04', '0.00',
'B2', 1),
('103', '10112', 'thirdac', '2013-02-21', 'RN', 'TNA', '2013-02-22', '0.00', 'C2
', 1),
('104', '12620', 'thirdac', '2013-02-27', 'MAO', 'CSTM', '2013-03-04', '0.00', '
C3', 1);

-- ---------------------------------------------------------- Table structure for table `Books`


-CREATE TABLE IF NOT EXISTS `Books` (
`isbn` varchar(15) NOT NULL,
`title` varchar(40) NOT NULL,
`author` varchar(40) NOT NULL,
`qty_in_stock` int(11) NOT NULL,
`price` decimal(10,0) NOT NULL,
`publication_year` int(11) NOT NULL,
PRIMARY KEY (`isbn`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `Books`
-INSERT INTO `Books` (`isbn`, `title`, `author`, `qty_in_stock`, `price`, `public
ation_year`) VALUES
('A1234', 'Data Structures and Algorithms', 'Cormen', 5, '350', 2007),
('A1235', 'Computer Networks', 'Stallings', 7, '500', 2003),
('A1236', 'Operating Systems', 'Stallings', 3, '800', 2000),
('A1237', 'C', 'Koffman', 10, '255', 2009),
('A1238', 'Applied Mathematics', 'Chandler', 20, '300', 1995);
-- ---------------------------------------------------------- Table structure for table `classfare`
-CREATE TABLE IF NOT EXISTS `classfare` (
`class` varchar(20) NOT NULL,
`fare` decimal(10,2) NOT NULL,
PRIMARY KEY (`class`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `classfare`
-INSERT INTO `classfare` (`class`, `fare`) VALUES
('firstac', '229.40'),
('secondac', '136.90'),
('sleeper', '37.00'),
('thirdac', '99.90');
-- ---------------------------------------------------------- Table structure for table `copassengers`
-CREATE TABLE IF NOT EXISTS `copassengers` (
`PNR` varchar(30) NOT NULL,
`name` varchar(40) NOT NULL,

`age` int(11) NOT NULL,


`gender` enum('M','F','m','f') NOT NULL,
`seatno` int(11) NOT NULL,
`berth` enum('lower','middle','upper') NOT NULL,
KEY `PNR` (`PNR`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `copassengers`
-INSERT INTO `copassengers` (`PNR`, `name`, `age`, `gender`, `seatno`, `berth`) V
ALUES
('101', 'Anju', 60, 'F', 74, 'lower'),
('101', 'Sonali', 32, 'F', 73, 'lower'),
('101', 'Pinky', 2, 'F', 72, 'middle');
-- ---------------------------------------------------------- Table structure for table `Customer`
-CREATE TABLE IF NOT EXISTS `Customer` (
`cid` int(11) NOT NULL,
`cname` varchar(40) NOT NULL,
`address` varchar(40) NOT NULL,
PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `Customer`
-INSERT INTO `Customer` (`cid`, `cname`, `address`) VALUES
(1, 'Amar', '23, M.G. road, Ahmadabad '),
(2, 'Akbar', 'D-20, Sainivas, Mumbai'),
(3, 'Pooja', 'sector no. 23, Vashi, Mumbai'),
(4, 'Saloni', 'Hyderabad'),
(5, 'John', 'Pune, Shivajinagar ');
-- ---------------------------------------------------------- Table structure for table `Orders`
-CREATE TABLE IF NOT EXISTS `Orders` (
`oisbn` varchar(15) NOT NULL,
`ocid` int(11) NOT NULL,
`qty` int(11) NOT NULL,
`orderdate` date NOT NULL,
PRIMARY KEY (`oisbn`,`orderdate`),
KEY `oisbn` (`oisbn`),
KEY `ocid` (`ocid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `Orders`
--

INSERT INTO `Orders` (`oisbn`, `ocid`, `qty`, `orderdate`) VALUES


('A1234', 1, 1, '2012-07-02'),
('A1234', 2, 2, '2013-10-01'),
('A1236', 1, 5, '2012-05-14'),
('A1236', 5, 4, '2012-12-30'),
('A1236', 3, 2, '2013-12-12');
-- ---------------------------------------------------------- Table structure for table `passengers`
-CREATE TABLE IF NOT EXISTS `passengers` (
`PNR` varchar(30) NOT NULL,
`name` varchar(40) NOT NULL,
`age` int(11) NOT NULL,
`gender` enum('M','F','m','f') NOT NULL,
`seatno` int(11) NOT NULL,
`berth` enum('lower','middle','upper') NOT NULL,
PRIMARY KEY (`PNR`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `passengers`
-INSERT INTO `passengers` (`PNR`, `name`, `age`, `gender`, `seatno`, `berth`) VAL
UES
('101', 'Abhay', 36, 'M', 75, 'upper'),
('102', 'Anish', 30, 'M', 75, 'upper'),
('103', 'Suman', 38, 'F', 45, 'lower'),
('104', 'Rohan', 25, 'M', 1, 'lower'),
('120', 'Johny', 34, 'M', 0, 'lower');
-- ---------------------------------------------------------- Table structure for table `seats`
-CREATE TABLE IF NOT EXISTS `seats` (
`traincode` varchar(20) NOT NULL,
`journeydate` date NOT NULL,
`firstacA1` int(11) NOT NULL DEFAULT '75',
`secondacB1` int(11) NOT NULL DEFAULT '75',
`secondacB2` int(11) NOT NULL DEFAULT '75',
`thirdacC1` int(11) NOT NULL DEFAULT '75',
`thirdacC2` int(11) NOT NULL DEFAULT '75',
`thirdacC3` int(11) NOT NULL DEFAULT '75',
`SL1` int(11) NOT NULL DEFAULT '75',
`SL2` int(11) NOT NULL DEFAULT '75',
`SL3` int(11) NOT NULL DEFAULT '75',
`SL4` int(11) NOT NULL DEFAULT '75',
PRIMARY KEY (`traincode`,`journeydate`),
KEY `traincode` (`traincode`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--

-- Dumping data for table `seats`


-INSERT INTO `seats` (`traincode`, `journeydate`, `firstacA1`, `secondacB1`, `sec
ondacB2`, `thirdacC1`, `thirdacC2`, `thirdacC3`, `SL1`, `SL2`, `SL3`, `SL4`) VAL
UES
('10112', '2013-02-22', 75, 75, 75, 75, 74, 75, 75, 75, 75, 75),
('12620', '2013-03-04', 75, 75, 74, 75, 75, 74, 75, 75, 75, 75),
('16345', '2013-03-01', 75, 71, 75, 75, 75, 75, 75, 75, 75, 75);
-- ---------------------------------------------------------- Table structure for table `stations`
-CREATE TABLE IF NOT EXISTS `stations` (
`stncode` varchar(10) NOT NULL,
`station_name` varchar(30) NOT NULL,
`dist_in_km` int(11) NOT NULL,
PRIMARY KEY (`stncode`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `stations`
-INSERT INTO `stations` (`stncode`, `station_name`, `dist_in_km`) VALUES
('CHI', 'CHIPLUN', 441),
('CSTM', 'MUMBAI CST', 765),
('DAD', 'DADAR', 756),
('MAO', 'MADGAON', 0),
('PNVL', 'PANVEL', 697),
('RN', 'RATNAGIRI', 335),
('SNDD', 'SINDHUDURG', 154),
('SWV', 'SAWANTWADI ROAD', 111),
('TNA', 'THANE', 732);
-- ---------------------------------------------------------- Table structure for table `student`
-CREATE TABLE IF NOT EXISTS `student` (
`id` int(5) NOT NULL,
`name` varchar(20) NOT NULL,
`date_of_birth` date NOT NULL,
`grand_total` int(11) NOT NULL,
`rank` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `student`
-INSERT INTO `student` (`id`, `name`, `date_of_birth`, `grand_total`, `rank`) VAL
UES
(1, 'AAA', '1996-02-06', 80, 0),

(2,
(3,
(4,
(5,
(6,
(7,
(8,

'BBB',
'CCC',
'DDD',
'EEE',
'FFF',
'GGG',
'HHH',

'1996-02-16',
'1996-03-28',
'1996-03-23',
'1997-06-18',
'1996-04-24',
'1996-05-17',
'1996-06-19',

85,
60,
80,
65,
40,
65,
50,

0),
0),
0),
0),
0),
0),
0);

-- ---------------------------------------------------------- Table structure for table `trains`


-CREATE TABLE IF NOT EXISTS `trains` (
`traincode` varchar(20) NOT NULL,
`train_name` varchar(20) NOT NULL,
`source_stncode` varchar(10) NOT NULL,
`departure_time` time NOT NULL,
`destination_stncode` varchar(10) NOT NULL,
`arrival_time` time NOT NULL,
`runson` varchar(20) NOT NULL,
PRIMARY KEY (`traincode`),
KEY `source stncode` (`source_stncode`),
KEY `destination stncode` (`destination_stncode`),
KEY `source stncode_2` (`source_stncode`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `trains`
-INSERT INTO `trains` (`traincode`, `train_name`, `source_stncode`, `departure_ti
me`, `destination_stncode`, `arrival_time`, `runson`) VALUES
('10104', 'MANDOVI', 'MAO', '09:30:00', 'CSTM', '21:30:00', 'weekends'),
('10112', 'KONKAN KANYA', 'MAO', '18:00:00', 'CSTM', '05:50:00', 'alldays'),
('12051', 'JAN SHATABDI', 'CSTM', '05:10:00', 'MAO', '14:10:00', 'alldays'),
('12620', 'MATSYAGANDHA', 'MAO', '20:55:00', 'CSTM', '06:35:00', 'alldays'),
('16345', 'NETRAVATI', 'CSTM', '12:55:00', 'MAO', '22:40:00', 'weekdays');
-- ---------------------------------------------------------- Table structure for table `waiting list`
-CREATE TABLE IF NOT EXISTS `waiting list` (
`PNR` varchar(30) NOT NULL,
`traincode` varchar(20) NOT NULL,
`class` varchar(20) NOT NULL,
`date_of_booking` date NOT NULL,
`source_station` varchar(10) NOT NULL,
`destination_station` varchar(10) NOT NULL,
`date_of_boarding` date NOT NULL,
`fare` decimal(10,2) NOT NULL,
`no_of_seats` int(11) NOT NULL,
PRIMARY KEY (`PNR`),
KEY `train code` (`traincode`),
KEY `class` (`class`),
KEY `source station` (`source_station`),

KEY `destination station` (`destination_station`)


) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--- Dumping data for table `waiting list`
-INSERT INTO `waiting list` (`PNR`, `traincode`, `class`, `date_of_booking`, `sou
rce_station`, `destination_station`, `date_of_boarding`, `fare`, `no_of_seats`)
VALUES
('120', '12620', 'thirdac', '2013-02-28', 'MAO', 'CSTM', '2013-03-04', '0.00', 1
);
--- Constraints for dumped tables
---- Constraints for table `booking`
-ALTER TABLE `booking`
ADD CONSTRAINT `booking_ibfk_6` FOREIGN KEY (`destination_station`) REFERENCES
`stations` (`stncode`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `booking_ibfk_1` FOREIGN KEY (`PNR`) REFERENCES `passengers` (`
PNR`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `booking_ibfk_3` FOREIGN KEY (`class`) REFERENCES `classfare` (
`class`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `booking_ibfk_4` FOREIGN KEY (`traincode`) REFERENCES `trains`
(`traincode`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `booking_ibfk_5` FOREIGN KEY (`source_station`) REFERENCES `sta
tions` (`stncode`) ON DELETE CASCADE ON UPDATE CASCADE;
--- Constraints for table `copassengers`
-ALTER TABLE `copassengers`
ADD CONSTRAINT `copassengers_ibfk_1` FOREIGN KEY (`PNR`) REFERENCES `passenger
s` (`PNR`) ON DELETE CASCADE ON UPDATE CASCADE;
--- Constraints for table `Orders`
-ALTER TABLE `Orders`
ADD CONSTRAINT `Orders_ibfk_2` FOREIGN KEY (`oisbn`) REFERENCES `Books` (`isbn
`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `Orders_ibfk_3` FOREIGN KEY (`ocid`) REFERENCES `Customer` (`ci
d`) ON DELETE CASCADE ON UPDATE CASCADE;
--- Constraints for table `seats`
-ALTER TABLE `seats`
ADD CONSTRAINT `seats_ibfk_1` FOREIGN KEY (`traincode`) REFERENCES `trains` (`
traincode`) ON DELETE CASCADE ON UPDATE CASCADE;
--- Constraints for table `trains`
-ALTER TABLE `trains`
ADD CONSTRAINT `trains_ibfk_2` FOREIGN KEY (`destination_stncode`) REFERENCES

`stations` (`stncode`) ON DELETE CASCADE ON UPDATE CASCADE,


ADD CONSTRAINT `trains_ibfk_1` FOREIGN KEY (`source_stncode`) REFERENCES `stat
ions` (`stncode`) ON DELETE CASCADE ON UPDATE CASCADE;
--- Constraints for table `waiting list`
-ALTER TABLE `waiting list`
ADD CONSTRAINT `waiting@0020list_ibfk_6` FOREIGN KEY (`destination_station`) R
EFERENCES `stations` (`stncode`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `waiting@0020list_ibfk_1` FOREIGN KEY (`PNR`) REFERENCES `passe
ngers` (`PNR`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `waiting@0020list_ibfk_3` FOREIGN KEY (`class`) REFERENCES `cla
ssfare` (`class`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `waiting@0020list_ibfk_4` FOREIGN KEY (`traincode`) REFERENCES
`trains` (`traincode`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `waiting@0020list_ibfk_5` FOREIGN KEY (`source_station`) REFERE
NCES `stations` (`stncode`) ON DELETE CASCADE ON UPDATE CASCADE;

Potrebbero piacerti anche