-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jan 15, 2018 at 11:49 PM
-- Server version: 5.7.19
-- PHP Version: 7.1.9

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


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

--
-- Database: `mojabanka2018`
--
CREATE DATABASE IF NOT EXISTS `mojabanka2018` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `mojabanka2018`;

-- --------------------------------------------------------

--
-- Table structure for table `bankari`
--

DROP TABLE IF EXISTS `bankari`;
CREATE TABLE IF NOT EXISTS `bankari` (
  `kor_ime` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `lozinka` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `ime` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `prezime` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`kor_ime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `bankari`
--

INSERT INTO `bankari` (`kor_ime`, `lozinka`, `ime`, `prezime`) VALUES
('ceca', 'vecaceca', 'Svetlana', 'Jovanovic'),
('mica', 'micaubica', 'Mica', 'Divnic');

-- --------------------------------------------------------

--
-- Table structure for table `korisnici`
--

DROP TABLE IF EXISTS `korisnici`;
CREATE TABLE IF NOT EXISTS `korisnici` (
  `kor_ime` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `lozinka` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `ime` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `prezime` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `jmbg` varchar(13) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`kor_ime`),
  KEY `fk_racun` (`kor_ime`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `korisnici`
--

INSERT INTO `korisnici` (`kor_ime`, `lozinka`, `ime`, `prezime`, `jmbg`) VALUES
('ivona', 'ivona123', 'Ivona', 'Serdar', '0505990715034'),
('marko', 'marko123', 'Marko', 'Urosevic', '1208987850323'),
('pera', 'pera123', 'Petar', 'Petrovic', '0601972710409'),
('tanja', 'tanja123', 'Tanja', 'Radmilovic', '2304983735981');

-- --------------------------------------------------------

--
-- Table structure for table `racuni`
--

DROP TABLE IF EXISTS `racuni`;
CREATE TABLE IF NOT EXISTS `racuni` (
  `br_racuna` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `vlasnik` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `stanje` decimal(10,2) NOT NULL,
  PRIMARY KEY (`br_racuna`),
  KEY `FK_vlasnik` (`vlasnik`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `racuni`
--

INSERT INTO `racuni` (`br_racuna`, `vlasnik`, `stanje`) VALUES
('105-124381-65', 'pera', '-432.12'),
('105-234124-64', 'tanja', '-12.05'),
('105-321520-66', 'marko', '5320.43'),
('105-974129-77', 'ivona', '1352.54');

-- --------------------------------------------------------

--
-- Table structure for table `transakcije`
--

DROP TABLE IF EXISTS `transakcije`;
CREATE TABLE IF NOT EXISTS `transakcije` (
  `id` int(15) NOT NULL AUTO_INCREMENT,
  `racun` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `iznos` decimal(10,2) NOT NULL,
  `datum` date NOT NULL,
  `naziv` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_racun` (`racun`)
) ENGINE=InnoDB AUTO_INCREMENT=513474 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `transakcije`
--

INSERT INTO `transakcije` (`id`, `racun`, `iznos`, `datum`, `naziv`) VALUES
(513454, '105-974129-77', '-2500.00', '2017-12-20', 'McDonald\'s'),
(513455, '105-974129-77', '23023.14', '2017-12-25', 'Drugi deo plate NOVEMBAR 2017'),
(513456, '105-974129-77', '23053.51', '2017-12-11', 'Prvi deo plate NOVEMBAR 2017'),
(513457, '105-974129-77', '24240.65', '2017-11-24', 'Drugi deo plate OKTOBAR 2017'),
(513458, '105-974129-77', '23461.93', '2017-11-10', 'Prvi deo plate OKTOBAR 2017'),
(513459, '105-974129-77', '-12048.47', '2017-12-15', 'Tempo'),
(513460, '105-974129-77', '-10000.00', '2018-01-12', 'Gotovinska isplata'),
(513461, '105-321520-66', '15000.00', '2018-01-15', 'Uplata na salteru'),
(513462, '105-321520-66', '-10000.00', '2018-01-12', 'ATM isplata'),
(513463, '105-234124-64', '-11245.91', '2018-01-06', 'Maxi'),
(513464, '105-124381-65', '-1289.00', '2017-12-28', 'Delfi knjizare'),
(513465, '105-124381-65', '15000.00', '2017-12-29', 'Novogodisnji bonus'),
(513466, '105-974129-77', '-250.00', '2018-01-14', 'Greenet'),
(513467, '105-124381-65', '-5000.00', '2017-11-24', 'Cek 1432871'),
(513468, '105-124381-65', '-3500.00', '2018-01-15', 'Cek 1432973'),
(513469, '105-124381-65', '43261.47', '2018-01-05', 'Prvi deo plate za decembar 2017'),
(513470, '105-234124-64', '2990.00', '2017-01-28', 'Naknada za prevoz januar 2018'),
(513471, '105-321520-66', '-2312.98', '2017-12-01', 'Aroma market'),
(513472, '105-321520-66', '20000.00', '2017-12-01', 'Socijalno'),
(513473, '105-124381-65', '15000.00', '2017-11-15', 'Uplata na salteru');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `racuni`
--
ALTER TABLE `racuni`
  ADD CONSTRAINT `racuni_ibfk_1` FOREIGN KEY (`vlasnik`) REFERENCES `korisnici` (`kor_ime`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Constraints for table `transakcije`
--
ALTER TABLE `transakcije`
  ADD CONSTRAINT `FK_racun_trans` FOREIGN KEY (`racun`) REFERENCES `racuni` (`br_racuna`) ON DELETE NO ACTION ON UPDATE NO ACTION;
COMMIT;

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