DatabaseManagementSystems/Practical/Assignment-A2/Database_A2.sql

186 lines
6.6 KiB
MySQL
Raw Normal View History

2024-07-25 14:35:07 +05:30
-- MySQL dump 10.13 Distrib 9.0.1, for Linux (x86_64)
--
-- Host: localhost Database: Database_A2
-- ------------------------------------------------------
-- Server version 9.0.1
/*!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 */;
/*!50503 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 */;
--
-- Table structure for table `Account`
--
DROP TABLE IF EXISTS `Account`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Account` (
`accountNum` int NOT NULL,
`branchName` varchar(50) DEFAULT NULL,
`balance` int DEFAULT NULL,
PRIMARY KEY (`accountNum`),
KEY `branchName` (`branchName`),
CONSTRAINT `Account_ibfk_1` FOREIGN KEY (`branchName`) REFERENCES `Branch` (`branchName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Account`
--
LOCK TABLES `Account` WRITE;
/*!40000 ALTER TABLE `Account` DISABLE KEYS */;
INSERT INTO `Account` VALUES (2501,'Dhole Patil',5000),(2511,'Nagarwala',1500),(2512,'Bishops',5000),(2521,'Peachtree',2000),(2531,'Amanora',1000);
/*!40000 ALTER TABLE `Account` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Borrower`
--
DROP TABLE IF EXISTS `Borrower`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Borrower` (
`customerName` varchar(50) DEFAULT NULL,
`loanNum` int DEFAULT NULL,
KEY `customerName` (`customerName`),
KEY `loanNum` (`loanNum`),
CONSTRAINT `Borrower_ibfk_1` FOREIGN KEY (`customerName`) REFERENCES `Customer` (`customerName`),
CONSTRAINT `Borrower_ibfk_2` FOREIGN KEY (`loanNum`) REFERENCES `Loan` (`loanNum`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Borrower`
--
LOCK TABLES `Borrower` WRITE;
/*!40000 ALTER TABLE `Borrower` DISABLE KEYS */;
INSERT INTO `Borrower` VALUES ('Kalas',156),('Mehul',158),('Tanmay',155),('Kshitij',157),('Aditya',159),('Himanshu',158);
/*!40000 ALTER TABLE `Borrower` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Branch`
--
DROP TABLE IF EXISTS `Branch`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Branch` (
`branchName` varchar(50) NOT NULL,
`branchCity` varchar(50) DEFAULT NULL,
`assets` int DEFAULT NULL,
PRIMARY KEY (`branchName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Branch`
--
LOCK TABLES `Branch` WRITE;
/*!40000 ALTER TABLE `Branch` DISABLE KEYS */;
INSERT INTO `Branch` VALUES ('Amanora','Hadapsar',60000),('Bishops','Nigdi',10000),('Dhole Patil','Kharadi',50000),('Nagarwala','Akurdi',20000),('Peachtree','Wakad',35000);
/*!40000 ALTER TABLE `Branch` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Customer`
--
DROP TABLE IF EXISTS `Customer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Customer` (
`customerName` varchar(50) NOT NULL,
`customerStreet` varchar(50) DEFAULT NULL,
`customerCity` varchar(50) DEFAULT NULL,
PRIMARY KEY (`customerName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Customer`
--
LOCK TABLES `Customer` WRITE;
/*!40000 ALTER TABLE `Customer` DISABLE KEYS */;
INSERT INTO `Customer` VALUES ('Aditya','Mira RD','Mumbai'),('Himanshu','Smart City','Nandurbar'),('Kalas','Airport Road','Pune'),('Kshitij','Hadapasar','Pune'),('Mehul','Shahdha','Nandurbar'),('Tanmay','Porwal Road','Pune');
/*!40000 ALTER TABLE `Customer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Depositor`
--
DROP TABLE IF EXISTS `Depositor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Depositor` (
`customerName` varchar(50) DEFAULT NULL,
`accountNum` int DEFAULT NULL,
KEY `customerName` (`customerName`),
KEY `accountNum` (`accountNum`),
CONSTRAINT `Depositor_ibfk_1` FOREIGN KEY (`customerName`) REFERENCES `Customer` (`customerName`),
CONSTRAINT `Depositor_ibfk_2` FOREIGN KEY (`accountNum`) REFERENCES `Account` (`accountNum`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Depositor`
--
LOCK TABLES `Depositor` WRITE;
/*!40000 ALTER TABLE `Depositor` DISABLE KEYS */;
INSERT INTO `Depositor` VALUES ('Kalas',2511),('Mehul',2512),('Tanmay',2501),('Kshitij',2521),('Aditya',2531),('Himanshu',2512);
/*!40000 ALTER TABLE `Depositor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Loan`
--
DROP TABLE IF EXISTS `Loan`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Loan` (
`loanNum` int NOT NULL,
`branchName` varchar(50) DEFAULT NULL,
`amount` int DEFAULT NULL,
PRIMARY KEY (`loanNum`),
KEY `branchName` (`branchName`),
CONSTRAINT `Loan_ibfk_1` FOREIGN KEY (`branchName`) REFERENCES `Branch` (`branchName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Loan`
--
LOCK TABLES `Loan` WRITE;
/*!40000 ALTER TABLE `Loan` DISABLE KEYS */;
INSERT INTO `Loan` VALUES (155,'Dhole Patil',500),(156,'Nagarwala',250),(157,'Peachtree',600),(158,'Bishops',1400),(159,'Amanora',25000);
2024-07-25 14:35:07 +05:30
/*!40000 ALTER TABLE `Loan` 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 2024-07-31 16:22:17