Skip to content

Instantly share code, notes, and snippets.

@rawaludin
Created February 6, 2014 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rawaludin/8838415 to your computer and use it in GitHub Desktop.
Save rawaludin/8838415 to your computer and use it in GitHub Desktop.
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `counter_customer` (
`total_customer` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `customer` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`nama` varchar(100) NOT NULL,
`alamat` varchar(100) NOT NULL,
`menu` int(10) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `menu_customer` (`menu`),
CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`menu`) REFERENCES `menu` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `customer` VALUES (1,'Deni','Bandung',1),(2,'Dudi','Jakarta',1),(3,'Dadang','Subang',2),(4,'Doni','Bekasi',2),(5,'Dede','Jogja',NULL),(6,'Didi','Bandung',1),(7,'Dodo','Bandung',1),(8,'Dadang','Bandung',2);
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `customer_from_bandung` (
`id` tinyint NOT NULL,
`nama` tinyint NOT NULL,
`alamat` tinyint NOT NULL,
`menu` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `data_pesanan` (
`nama` tinyint NOT NULL,
`Total Pesanan` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `menu` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`nama` varchar(100) NOT NULL,
`harga` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `menu` VALUES (1,'Ayam Crispy',25000),(2,'Ayam Bakar',30000),(3,'Ayam Pop',50000),(4,'Oncom',50000);
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `total` (
`Jenis` tinyint NOT NULL,
`Total` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE IF EXISTS `counter_customer`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `counter_customer` AS select count(`customer`.`id`) AS `total_customer` from `customer` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE IF EXISTS `customer_from_bandung`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `customer_from_bandung` AS select `customer`.`id` AS `id`,`customer`.`nama` AS `nama`,`customer`.`alamat` AS `alamat`,`customer`.`menu` AS `menu` from `customer` where (`customer`.`alamat` = 'Bandung') */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE IF EXISTS `data_pesanan`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `data_pesanan` AS select `menu`.`nama` AS `nama`,count(`customer`.`menu`) AS `Total Pesanan` from (`menu` left join `customer` on((`menu`.`id` = `customer`.`menu`))) group by `customer`.`menu` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE IF EXISTS `total`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `total` AS select 'Total Customer' AS `Jenis`,count(`customer`.`id`) AS `Total` from `customer` union select 'Total Menu' AS `Jenis`,count(`menu`.`id`) AS `Total` from `menu` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment