Calcan_Conze/Dateien/Import_Export_part_1.sql

186 lines
5.9 KiB
SQL

-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 24. Nov 2017 um 17:01
-- Server-Version: 10.1.16-MariaDB
-- PHP-Version: 7.0.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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 */;
-- --------------------------------------------------------
CREATE TABLE `user` (
`id` int(8) NOT NULL,
`clientId` int(8) NOT NULL,
`genderId` tinyint(1) NOT NULL,
`firstname` varchar(40) NOT NULL,
`lastname` varchar(80) NOT NULL,
`birthdate` date NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `gender` (
`id` tinyint(1) NOT NULL,
`description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `address` (
`id` int(8) NOT NULL,
`userId` int(8) NOT NULL,
`street` varchar(400) NOT NULL,
`postalcode` int(255) NOT NULL,
`city` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `email` (
`id` int(8) NOT NULL,
`userId` int(8) NOT NULL,
`email` varchar(400) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `phone` (
`id` int(8) NOT NULL,
`userId` int(8) NOT NULL,
`phoneprefix` int(6) NOT NULL,
`phonenumber` int(10) NOT null
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `client` (
`id` int(8) NOT NULL,
`name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-------
ALTER TABLE `gender`
ADD PRIMARY KEY (`id`);
ALTER TABLE `client`
ADD PRIMARY KEY (`id`);
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD CONSTRAINT FK_user_client FOREIGN KEY (`clientId`) REFERENCES client(`id`),
ADD CONSTRAINT FK_user_gender FOREIGN KEY (`genderId`) REFERENCES gender(`id`);
ALTER TABLE `phone`
ADD PRIMARY KEY (`id`),
ADD CONSTRAINT FK_user_phone FOREIGN KEY (`userId`) REFERENCES user(`id`);
ALTER TABLE `address`
ADD PRIMARY KEY (`id`),
ADD CONSTRAINT FK_user_address FOREIGN KEY (`userId`) REFERENCES user(`id`);
ALTER TABLE `email`
ADD PRIMARY KEY (`id`),
ADD CONSTRAINT FK_user_email FOREIGN KEY (`userId`) REFERENCES user(`id`);
---- Werte
INSERT INTO `gender` VALUES (1, 'Herr')
, (2, 'Frau')
, (3, 'Divers');
INSERT INTO `client` VALUES (1, 'bibtastic GmbH')
, (2, 'Weyland-Yutani Corporation');
INSERT INTO `user` (`id`, `clientId`, `genderId`, `firstname`, `lastname`, `birthdate`, `created`) VALUES
(1, 1, 1, 'Max', 'Mustermann', '1985-05-15', CURRENT_TIMESTAMP),
(2, 1, 2, 'Erika', 'Musterfrau', '1990-07-20', CURRENT_TIMESTAMP),
(3, 2, 1, 'Hans', 'Schmidt', '1978-11-30', CURRENT_TIMESTAMP),
(4, 2, 2, 'Anna', 'Schneider', '1983-02-25', CURRENT_TIMESTAMP),
(5, 1, 1, 'Peter', 'Müller', '1992-03-17', CURRENT_TIMESTAMP),
(6, 1, 2, 'Maria', 'Bauer', '1987-08-05', CURRENT_TIMESTAMP),
(7, 2, 1, 'Michael', 'Fischer', '1984-12-12', CURRENT_TIMESTAMP),
(8, 2, 2, 'Laura', 'Weber', '1991-09-10', CURRENT_TIMESTAMP),
(9, 1, 1, 'Thomas', 'Wagner', '1989-06-24', CURRENT_TIMESTAMP),
(10, 1, 2, 'Sophia', 'Becker', '1993-01-18', CURRENT_TIMESTAMP),
(11, 2, 1, 'Daniel', 'Hoffmann', '1982-10-03', CURRENT_TIMESTAMP),
(12, 2, 2, 'Katharina', 'Koch', '1986-04-22', CURRENT_TIMESTAMP),
(13, 1, 1, 'Stefan', 'Richter', '1988-07-29', CURRENT_TIMESTAMP),
(14, 1, 2, 'Julia', 'Klein', '1995-05-08', CURRENT_TIMESTAMP),
(15, 2, 1, 'Sebastian', 'Wolf', '1981-11-14', CURRENT_TIMESTAMP);
INSERT INTO `phone` (`id`, `userId`, `phoneprefix`, `phonenumber`) VALUES
('1', '1', 30, 12345678),
('2', '2', 89, 87654321),
('3', '3', 221, 11223344),
('4', '4', 40, 55667788),
('5', '5', 511, 99887766),
('6', '6', 351, 33445566),
('7', '7', 341, 77889900),
('8', '8', 561, 44556677),
('9', '9', 611, 22334455),
('10', '10', 541, 66778899),
('11', '11', 821, 11002233),
('12', '12', 361, 99001122),
('13', '13', 551, 33446688),
('14', '14', 331, 22114455),
('15', '15', 6131, 55668844),
('21', '1', 170, 12349876),
('22', '2', 172, 23456789),
('23', '3', 176, 34567890),
('24', '4', 179, 45678901),
('25', '5', 170, 56789012),
('26', '6', 172, 67890123),
('27', '7', 176, 78901234),
('28', '8', 179, 89012345),
('29', '9', 170, 90123456),
('30', '10', 172, 11223344),
('31', '11', 176, 22334455),
('32', '12', 179, 33445566),
('33', '13', 170, 44556677),
('34', '14', 172, 55667788),
('35', '15', 176, 66778899);
INSERT INTO `email` (`id`, `userId`, `email`) VALUES
(1, 1, 'max.mustermann@example.com'),
(2, 2, 'erika.musterfrau@example.com'),
(3, 3, 'hans.schmidt@example.com'),
(4, 4, 'anna.schneider@example.com'),
(5, 5, 'peter.muller@example.com'),
(6, 6, 'maria.bauer@example.com'),
(7, 7, 'michael.fischer@example.com'),
(8, 8, 'laura.weber@example.com'),
(9, 9, 'thomas.wagner@example.com'),
(10, 10, 'sophia.becker@example.com'),
(11, 11, 'daniel.hoffmann@example.com'),
(12, 12, 'katharina.koch@example.com'),
(13, 13, 'stefan.richter@example.com'),
(14, 14, 'julia.klein@example.com'),
(15, 15, 'sebastian.wolf@example.com');
INSERT INTO `address` (`id`, `userId`, `street`, `postalcode`, `city`) VALUES
(1, 1, 'Musterstraße 1', 10115, 'Berlin'),
(2, 2, 'Beispielweg 23', 80331, 'München'),
(3, 3, 'Hauptstraße 45', 50667, 'Köln'),
(4, 4, 'Parkallee 12', 20095, 'Hamburg'),
(5, 5, 'Bahnhofstraße 88', 30159, 'Hannover'),
(6, 6, 'Schulstraße 6', 01067, 'Dresden'),
(7, 7, 'Ringstraße 19', 04109, 'Leipzig'),
(8, 8, 'Lindenweg 22', 34117, 'Kassel'),
(9, 9, 'Bergstraße 15', 65183, 'Wiesbaden'),
(10, 10, 'Feldweg 30', 49074, 'Osnabrück'),
(11, 11, 'Marktstraße 14', 86150, 'Augsburg'),
(12, 12, 'Gartenstraße 8', 99084, 'Erfurt'),
(13, 13, 'Dorfstraße 11', 37073, 'Göttingen'),
(14, 14, 'Kirchplatz 7', 14467, 'Potsdam');
/*!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 */;