-- MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version	6.0.0-alpha-community-nt-debug


/*!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 utf8 */;

/*!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' */;


--
-- Create schema 2301694
--

CREATE DATABASE IF NOT EXISTS 2301694;
USE 2301694;

--
-- Definition of table `account`
--

DROP TABLE IF EXISTS `account`;
CREATE TABLE `account` (
  `account_number` char(5) NOT NULL,
  `balance` double NOT NULL,
  `branch_name` varchar(45) NOT NULL,
  PRIMARY KEY (`account_number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Bank example';

--
-- Dumping data for table `account`
--

/*!40000 ALTER TABLE `account` DISABLE KEYS */;
INSERT INTO `account` (`account_number`,`balance`,`branch_name`) VALUES 
 ('A-101',500,'Downtown'),
 ('A-102',400,'Perryridge'),
 ('A-201',900,'Brighton'),
 ('A-215',700,'Mianus'),
 ('A-217',750,'Brighton'),
 ('A-222',700,'Redwood'),
 ('A-305',360,'Round Hill');
/*!40000 ALTER TABLE `account` ENABLE KEYS */;


--
-- Definition of table `borrower`
--

DROP TABLE IF EXISTS `borrower`;
CREATE TABLE `borrower` (
  `customer_name` varchar(45) NOT NULL,
  `loan_number` char(4) NOT NULL,
  PRIMARY KEY (`customer_name`,`loan_number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `borrower`
--

/*!40000 ALTER TABLE `borrower` DISABLE KEYS */;
INSERT INTO `borrower` (`customer_name`,`loan_number`) VALUES 
 ('Adams','L-16'),
 ('Curry','L-93'),
 ('Hayes','L-15'),
 ('Jackson','L-14'),
 ('Jones','L-17'),
 ('Smith','L-11'),
 ('Smith','L-23'),
 ('Williams','L-17');
/*!40000 ALTER TABLE `borrower` ENABLE KEYS */;


--
-- Definition of table `branch`
--

DROP TABLE IF EXISTS `branch`;
CREATE TABLE `branch` (
  `branch_name` varchar(40) NOT NULL,
  `branch_city` varchar(45) NOT NULL,
  `assets` double NOT NULL,
  PRIMARY KEY (`branch_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `branch`
--

/*!40000 ALTER TABLE `branch` DISABLE KEYS */;
INSERT INTO `branch` (`branch_name`,`branch_city`,`assets`) VALUES 
 ('Brighton','Brooklyn',7100000),
 ('Downtown','Brooklyn',9000000),
 ('Mianus','Horseneck',400000),
 ('North Town','Rye',3700000),
 ('Perryridge','Horseneck',1700000),
 ('Pownal','Bennington',300000),
 ('Redwood','Palo Alto',2100000),
 ('Round Hill','Horseneck',8000000);
/*!40000 ALTER TABLE `branch` ENABLE KEYS */;


--
-- Definition of table `customer`
--

DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
  `customer_id` char(11) NOT NULL,
  `customer_name` varchar(45) NOT NULL,
  `customer_street` varchar(45) NOT NULL,
  `customer_city` varchar(20) NOT NULL,
  `account_number` char(5) NOT NULL,
  PRIMARY KEY (`customer_id`,`account_number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Bank example';

--
-- Dumping data for table `customer`
--

/*!40000 ALTER TABLE `customer` DISABLE KEYS */;
INSERT INTO `customer` (`customer_id`,`customer_name`,`customer_street`,`customer_city`,`account_number`) VALUES 
 ('019-28-3746','Smith','72 North St.','Rye','A-201'),
 ('182-73-6091','Turner','123 Putnam St.','Stanmford','A-305'),
 ('192-83-7465','Johnson','12 Alma St.','Palo Alto','A-101'),
 ('192-83-7465','Johnson','12 Alma St.','Palo Alto','A-201'),
 ('321-12-3123','Jones','100 Main St.','Harrison','A-217'),
 ('336-66-9999','Lindsay','175 Park Ave.','Pittsfield','A-222'),
 ('677-89-9011','Ilayes','3 Main St.','IIarrison','A-102');
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;


--
-- Definition of table `depositor`
--

DROP TABLE IF EXISTS `depositor`;
CREATE TABLE `depositor` (
  `customer_id` char(11) NOT NULL,
  `account_number` char(5) NOT NULL,
  PRIMARY KEY (`account_number`,`customer_id`),
  KEY `FK_depositor_1` (`customer_id`),
  CONSTRAINT `FK_depositor_1` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`),
  CONSTRAINT `FK_depositor_2` FOREIGN KEY (`account_number`) REFERENCES `account` (`account_number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Relationship';

--
-- Dumping data for table `depositor`
--

/*!40000 ALTER TABLE `depositor` DISABLE KEYS */;
INSERT INTO `depositor` (`customer_id`,`account_number`) VALUES 
 ('019-28-3746','A-201'),
 ('019-28-3746','A-215'),
 ('182-73-6091','A-217'),
 ('192-83-7465','A-101'),
 ('192-83-7465','A-201'),
 ('321-12-3123','A-217'),
 ('336-66-9999','A-222'),
 ('677-89-9011','A-305');
/*!40000 ALTER TABLE `depositor` ENABLE KEYS */;


--
-- Definition of table `loan`
--

DROP TABLE IF EXISTS `loan`;
CREATE TABLE `loan` (
  `loan_number` char(4) NOT NULL,
  `branch_name` varchar(40) NOT NULL,
  `amount` double NOT NULL,
  PRIMARY KEY (`loan_number`),
  KEY `FK_loan_1` (`branch_name`),
  CONSTRAINT `FK_loan_1` FOREIGN KEY (`branch_name`) REFERENCES `branch` (`branch_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `loan`
--

/*!40000 ALTER TABLE `loan` DISABLE KEYS */;
INSERT INTO `loan` (`loan_number`,`branch_name`,`amount`) VALUES 
 ('L-11','Round Hill',900),
 ('L-14','Downtown',1500),
 ('L-15','Perryridge',1500),
 ('L-16','Perryridge',1300),
 ('L-17','Downtown',1000),
 ('L-23','Redwood',2000),
 ('L-93','Mianus',500);
/*!40000 ALTER TABLE `loan` ENABLE KEYS */;




/*!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 */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;