SQL
Tubesunknown
sql
3 years ago
15 kB
6
Indexable
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Win64 (AMD64) -- -- Host: localhost Database: gotix -- ------------------------------------------------------ -- Server version 10.6.4-MariaDB /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Current Database: `gotix` -- CREATE DATABASE /*!32312 IF NOT EXISTS*/ `gotix` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `gotix`; -- -- Table structure for table `activity_info` -- DROP TABLE IF EXISTS `activity_info`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `activity_info` ( `activity_id` int(12) NOT NULL AUTO_INCREMENT, `info` longtext DEFAULT NULL, PRIMARY KEY (`activity_id`), KEY `IFK_activity_activity_id` (`activity_id`), CONSTRAINT `FK_activity_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `activity_ticket` (`activity_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `activity_info` -- LOCK TABLES `activity_info` WRITE; /*!40000 ALTER TABLE `activity_info` DISABLE KEYS */; /*!40000 ALTER TABLE `activity_info` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `activity_ticket` -- DROP TABLE IF EXISTS `activity_ticket`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `activity_ticket` ( `activity_id` int(12) NOT NULL AUTO_INCREMENT, `booking_id` int(12) NOT NULL, `activity_name` varchar(50) NOT NULL, `date` date NOT NULL DEFAULT current_timestamp(), `type` varchar(50) NOT NULL, `price` int(50) NOT NULL, PRIMARY KEY (`activity_id`), KEY `IFK_activity_booking_id` (`booking_id`), CONSTRAINT `FK_activity_booking_id` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`booking_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `activity_ticket` -- LOCK TABLES `activity_ticket` WRITE; /*!40000 ALTER TABLE `activity_ticket` DISABLE KEYS */; /*!40000 ALTER TABLE `activity_ticket` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `bookings` -- DROP TABLE IF EXISTS `bookings`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bookings` ( `booking_id` int(12) NOT NULL AUTO_INCREMENT, `user_id` int(12) NOT NULL, `type` varchar(50) NOT NULL, `num_of_ticket` int(50) NOT NULL, `payment_method` varchar(50) NOT NULL, `status` varchar(50) NOT NULL, PRIMARY KEY (`booking_id`), KEY `IFK_bookings_user_id` (`user_id`), CONSTRAINT `FK_bookings_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `bookings` -- LOCK TABLES `bookings` WRITE; /*!40000 ALTER TABLE `bookings` DISABLE KEYS */; /*!40000 ALTER TABLE `bookings` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `chain` -- DROP TABLE IF EXISTS `chain`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `chain` ( `chain_id` int(12) NOT NULL AUTO_INCREMENT, `chain_name` varchar(50) NOT NULL, `website` varchar(100) DEFAULT NULL, `contact_number` int(50) NOT NULL, PRIMARY KEY (`chain_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `chain` -- LOCK TABLES `chain` WRITE; /*!40000 ALTER TABLE `chain` DISABLE KEYS */; /*!40000 ALTER TABLE `chain` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `cinema` -- DROP TABLE IF EXISTS `cinema`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cinema` ( `cinema_id` int(12) NOT NULL AUTO_INCREMENT, `chain_id` int(12) NOT NULL, `cinema_name` varchar(50) NOT NULL, `city` varchar(50) DEFAULT NULL, `address` varchar(50) DEFAULT NULL, PRIMARY KEY (`cinema_id`), KEY `IFK_cinema_chain_id` (`chain_id`), CONSTRAINT `FK_cinema_chain_id` FOREIGN KEY (`chain_id`) REFERENCES `chain` (`chain_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `cinema` -- LOCK TABLES `cinema` WRITE; /*!40000 ALTER TABLE `cinema` DISABLE KEYS */; /*!40000 ALTER TABLE `cinema` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `event_info` -- DROP TABLE IF EXISTS `event_info`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `event_info` ( `event_id` int(12) NOT NULL AUTO_INCREMENT, `info` text DEFAULT NULL, PRIMARY KEY (`event_id`), KEY `IFK_event_event_id` (`event_id`), CONSTRAINT `FK_event_event_id` FOREIGN KEY (`event_id`) REFERENCES `event_ticket` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `event_info` -- LOCK TABLES `event_info` WRITE; /*!40000 ALTER TABLE `event_info` DISABLE KEYS */; /*!40000 ALTER TABLE `event_info` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `event_ticket` -- DROP TABLE IF EXISTS `event_ticket`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `event_ticket` ( `event_id` int(12) NOT NULL AUTO_INCREMENT, `booking_id` int(12) NOT NULL, `event_name` varchar(50) DEFAULT NULL, `date_and_time` timestamp NOT NULL DEFAULT current_timestamp(), `type` varchar(50) DEFAULT NULL, `price` int(50) DEFAULT NULL, PRIMARY KEY (`event_id`), KEY `IFK_event_booking_id` (`booking_id`), CONSTRAINT `FK_event_booking_id` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`booking_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `event_ticket` -- LOCK TABLES `event_ticket` WRITE; /*!40000 ALTER TABLE `event_ticket` DISABLE KEYS */; /*!40000 ALTER TABLE `event_ticket` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `genre` -- DROP TABLE IF EXISTS `genre`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `genre` ( `genre_id` int(12) NOT NULL AUTO_INCREMENT, `genre_name` varchar(50) DEFAULT NULL, PRIMARY KEY (`genre_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `genre` -- LOCK TABLES `genre` WRITE; /*!40000 ALTER TABLE `genre` DISABLE KEYS */; /*!40000 ALTER TABLE `genre` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `movie` -- DROP TABLE IF EXISTS `movie`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `movie` ( `movie_id` int(12) NOT NULL AUTO_INCREMENT, `title` varchar(50) NOT NULL, `synopsis` varchar(200) DEFAULT NULL, `duration` int(50) NOT NULL, PRIMARY KEY (`movie_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `movie` -- LOCK TABLES `movie` WRITE; /*!40000 ALTER TABLE `movie` DISABLE KEYS */; /*!40000 ALTER TABLE `movie` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `movie_genre` -- DROP TABLE IF EXISTS `movie_genre`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `movie_genre` ( `genre_id` int(12) NOT NULL AUTO_INCREMENT, `movie_id` int(12) NOT NULL, PRIMARY KEY (`genre_id`), KEY `IFK_movgenre_genre_id` (`genre_id`), KEY `IFK_movgenre_movie_id` (`movie_id`), CONSTRAINT `FK_movgenre_genre_id` FOREIGN KEY (`genre_id`) REFERENCES `genre` (`genre_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_movgenre_movie_id` FOREIGN KEY (`movie_id`) REFERENCES `movie` (`movie_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `movie_genre` -- LOCK TABLES `movie_genre` WRITE; /*!40000 ALTER TABLE `movie_genre` DISABLE KEYS */; /*!40000 ALTER TABLE `movie_genre` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `movie_ticket` -- DROP TABLE IF EXISTS `movie_ticket`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `movie_ticket` ( `movie_id` int(12) NOT NULL AUTO_INCREMENT, `booking_id` int(12) NOT NULL, `date_and_time` timestamp NOT NULL DEFAULT current_timestamp(), `price` int(50) DEFAULT NULL, PRIMARY KEY (`movie_id`), KEY `IFK_movie_booking_id` (`booking_id`), CONSTRAINT `FK_movie_booking_id` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`booking_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `movie_ticket` -- LOCK TABLES `movie_ticket` WRITE; /*!40000 ALTER TABLE `movie_ticket` DISABLE KEYS */; /*!40000 ALTER TABLE `movie_ticket` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `movie_ticket_info` -- DROP TABLE IF EXISTS `movie_ticket_info`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `movie_ticket_info` ( `movie_id` int(12) NOT NULL, `genre_id` int(12) NOT NULL, `movie_ticket_id` int(12) NOT NULL, `chain_id` int(12) NOT NULL, `cinema_id` int(12) NOT NULL, `studio_num` int(50) NOT NULL, `seat_num` int(50) NOT NULL, PRIMARY KEY (`movie_id`,`genre_id`,`movie_ticket_id`,`chain_id`,`cinema_id`,`studio_num`,`seat_num`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `movie_ticket_info` -- LOCK TABLES `movie_ticket_info` WRITE; /*!40000 ALTER TABLE `movie_ticket_info` DISABLE KEYS */; /*!40000 ALTER TABLE `movie_ticket_info` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `seats` -- DROP TABLE IF EXISTS `seats`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `seats` ( `seat_num` int(50) NOT NULL, `studio_num` int(50) NOT NULL, `cinema_id` int(12) NOT NULL, `seat_type` varchar(50) DEFAULT NULL, PRIMARY KEY (`seat_num`,`studio_num`,`cinema_id`), KEY `IFK_seat_studio_num` (`studio_num`), KEY `IFK_seat_cinema_id` (`cinema_id`), CONSTRAINT `FK_seat_cinema_id` FOREIGN KEY (`cinema_id`) REFERENCES `studio` (`cinema_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_seat_studio_num` FOREIGN KEY (`studio_num`) REFERENCES `studio` (`studio_num`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `seats` -- LOCK TABLES `seats` WRITE; /*!40000 ALTER TABLE `seats` DISABLE KEYS */; /*!40000 ALTER TABLE `seats` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `studio` -- DROP TABLE IF EXISTS `studio`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `studio` ( `studio_num` int(50) NOT NULL, `cinema_id` int(12) NOT NULL, `movie_id` int(12) NOT NULL, `capacity` int(50) NOT NULL, PRIMARY KEY (`studio_num`,`cinema_id`), KEY `IFK_studio_cinema_id` (`cinema_id`), KEY `IFK_studio_movie_id` (`movie_id`), CONSTRAINT `FK_studio_cinema_id` FOREIGN KEY (`cinema_id`) REFERENCES `cinema` (`cinema_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_studio_movie_id` FOREIGN KEY (`movie_id`) REFERENCES `movie` (`movie_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `studio` -- LOCK TABLES `studio` WRITE; /*!40000 ALTER TABLE `studio` DISABLE KEYS */; /*!40000 ALTER TABLE `studio` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user` -- DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user` ( `user_id` int(12) NOT NULL AUTO_INCREMENT, `user_name` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `gender` varchar(10) NOT NULL, `date_of_birth` date NOT NULL DEFAULT current_timestamp(), `phone` int(20) NOT NULL, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user` -- LOCK TABLES `user` WRITE; /*!40000 ALTER TABLE `user` DISABLE KEYS */; /*!40000 ALTER TABLE `user` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2021-11-11 13:38:49
Editor is loading...