21
Oct
09

TUgas Bu Beta2

– —————————-
– Table structure for booking
– —————————-
CREATE TABLE `booking` (
`guestno` varchar(8) default NULL,
`datefrom` date NOT NULL default ‘0000-00-00′,
`dateto` date NOT NULL default ‘0000-00-00′,
`hotelno` varchar(5) NOT NULL,
`roomno` varchar(5) NOT NULL default ”,
PRIMARY KEY (`datefrom`,`dateto`,`hotelno`,`roomno`),
KEY `hotelno` (`hotelno`,`roomno`),
CONSTRAINT `booking` FOREIGN KEY (`hotelno`, `roomno`) REFERENCES `room` (`hotelno`, `roomno`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

– —————————-
– Table structure for guest
– —————————-
CREATE TABLE `guest` (
`guestno` varchar(8) NOT NULL,
`guestname` varchar(30) default NULL,
`guestaddress` varchar(75) default NULL,
`telpon` varchar(20) default NULL,
PRIMARY KEY (`guestno`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

– —————————-
– Table structure for hotel
– —————————-
CREATE TABLE `hotel` (
`hotelno` varchar(5) NOT NULL default ”,
`hotelname` varchar(75) default NULL,
`street` varchar(50) default NULL,
`city` varchar(50) default NULL,
`country` varchar(35) default NULL,
PRIMARY KEY (`hotelno`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

– —————————-
– Table structure for room
– —————————-
CREATE TABLE `room` (
`roomno` varchar(5) NOT NULL default ”,
`hotelno` varchar(5) NOT NULL default ”,
`type` varchar(10) default NULL,
`price` decimal(10,0) default NULL,
PRIMARY KEY (`roomno`,`hotelno`),
KEY `hotelno` (`hotelno`),
KEY `hotelno_2` (`hotelno`,`roomno`),
CONSTRAINT `hotelno` FOREIGN KEY (`hotelno`) REFERENCES `hotel` (`hotelno`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

– —————————-
– Records
– —————————-
INSERT INTO `booking` VALUES (’09100001′, ‘2009-10-20′, ‘2009-10-23′, ‘A0001′, ‘I1001′);
INSERT INTO `booking` VALUES (’09100002′, ‘2009-10-21′, ‘2009-10-22′, ‘A0002′, ‘I1002′);
INSERT INTO `booking` VALUES (’09100003′, ‘2009-10-24′, ‘2009-10-26′, ‘A0001′, ‘I1001′);
INSERT INTO `booking` VALUES (’09100001′, ‘2009-10-26′, ‘2009-10-28′, ‘A0002′, ‘I1004′);
INSERT INTO `guest` VALUES (’09100001′, ‘Edi Widodo’, ‘Semarang’, ‘080989999′);
INSERT INTO `guest` VALUES (’09100002′, ‘Farhan’, ‘Jakarta’, ‘088800808′);
INSERT INTO `guest` VALUES (’09100003′, ‘Ahmadinejad’, ‘Irak’, ‘088888888′);
INSERT INTO `hotel` VALUES (’A0001′, ‘Grand Candi Hotel’, ‘Jl. Sultan Agung’, ‘Semarang’, ‘Indonesia’);
INSERT INTO `hotel` VALUES (’A0002′, ‘Ciputra Hotel’, ‘Jl. Jend. Sudirman’, ‘Semarang’, ‘Indonesia’);
INSERT INTO `room` VALUES (’I1001′, ‘A0001′, ‘STANDARD’, ‘100000′);
INSERT INTO `room` VALUES (’I1001′, ‘A0002′, ‘STANDARD’, ‘250000′);
INSERT INTO `room` VALUES (’I1002′, ‘A0001′, ‘MODERATE’, ‘150000′);
INSERT INTO `room` VALUES (’I1002′, ‘A0002′, ‘MODERATE’, ‘300000′);
INSERT INTO `room` VALUES (’I1003′, ‘A0001′, ‘SUPERIOR’, ‘200000′);
INSERT INTO `room` VALUES (’I1003′, ‘A0002′, ‘SUPERIOR’, ‘350000′);
INSERT INTO `room` VALUES (’I1004′, ‘A0001′, ‘DELUXE’, ‘250000′);
INSERT INTO `room` VALUES (’I1004′, ‘A0002′, ‘DELUXE’, ‘400000′);

btw, isi recordnya diganti aja, jadi biar beda-beda sekelas…


0 Responses to “TUgas Bu Beta2”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: