add the db for the 4th semester database

This commit is contained in:
Andreas Zweili 2017-11-02 20:56:37 +01:00
parent caed6fb014
commit 7939d7b5b5
7 changed files with 358 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# SQL Server Management Studio Solution File, Format Version 11.00
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "ArztDB", "ArztDB\ArztDB.ssmssqlproj", "{2FEF68A4-CD1C-486B-B9FC-0EABC10382A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Default|Default = Default|Default
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2FEF68A4-CD1C-486B-B9FC-0EABC10382A3}.Default|Default.ActiveCfg = Default
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="ArztDB">
<Items>
<LogicalFolder Name="Connections" Type="2" Sorted="true">
<Items>
<ConnectionNode Name="KETA04:KETA04\lm">
<Created>2014-12-06T15:15:00.9577918+01:00</Created>
<Type>SQL</Type>
<Server>KETA04</Server>
<UserName />
<Authentication>Windows Authentication</Authentication>
<InitialDB />
<LoginTimeout>15</LoginTimeout>
<ExecutionTimeout>0</ExecutionTimeout>
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
</ConnectionNode>
</Items>
</LogicalFolder>
<LogicalFolder Name="Queries" Type="0" Sorted="true">
<Items>
<FileNode Name="arzt_ceate_db.sql">
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:KETA04:True</AssociatedConnectionMoniker>
<AssociatedConnSrvName>KETA04</AssociatedConnSrvName>
<AssociatedConnUserName />
<FullPath>arzt_ceate_db.sql</FullPath>
</FileNode>
<FileNode Name="arzt_delete_data.sql">
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:KETA04:True</AssociatedConnectionMoniker>
<AssociatedConnSrvName>KETA04</AssociatedConnSrvName>
<AssociatedConnUserName />
<FullPath>arzt_delete_data.sql</FullPath>
</FileNode>
<FileNode Name="arzt_drop_db.sql">
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:KETA04:True</AssociatedConnectionMoniker>
<AssociatedConnSrvName>KETA04</AssociatedConnSrvName>
<AssociatedConnUserName />
<FullPath>arzt_drop_db.sql</FullPath>
</FileNode>
<FileNode Name="arzt_insert_data.sql">
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:KETA04:True</AssociatedConnectionMoniker>
<AssociatedConnSrvName>KETA04</AssociatedConnSrvName>
<AssociatedConnUserName />
<FullPath>arzt_insert_data.sql</FullPath>
</FileNode>
</Items>
</LogicalFolder>
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true">
<Items />
</LogicalFolder>
</Items>
</SqlWorkbenchSqlProject>

View File

@ -0,0 +1,104 @@
/* ---------------------------------------------------------------------- */
/* Script generated with: DeZign for Databases V7.2.0 */
/* Target DBMS: MS SQL Server 2012 */
/* Project file: ArztDatenbank.dez */
/* Project name: */
/* Author: */
/* Script type: Database creation script */
/* Created on: 2014-12-06 15:06 */
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
/* Select database */
/* ---------------------------------------------------------------------- */
use ArztDB;
/* ---------------------------------------------------------------------- */
/* Tables */
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
/* Add table "Ort" */
/* ---------------------------------------------------------------------- */
CREATE TABLE [Ort] (
[OrtNr] INTEGER IDENTITY(1,1) NOT NULL,
[PLZ] INTEGER,
[Ort] VARCHAR(60),
CONSTRAINT [PK_Ort] PRIMARY KEY ([OrtNr])
)
GO
/* ---------------------------------------------------------------------- */
/* Add table "Arzt" */
/* ---------------------------------------------------------------------- */
CREATE TABLE [Arzt] (
[ArztNr] INTEGER NOT NULL,
[ArztName] VARCHAR(60),
[OrtNr] INTEGER NOT NULL,
CONSTRAINT [PK_Arzt] PRIMARY KEY ([ArztNr])
)
GO
/* ---------------------------------------------------------------------- */
/* Add table "Patient" */
/* ---------------------------------------------------------------------- */
CREATE TABLE [Patient] (
[PatientNr] INTEGER NOT NULL,
[PatientName] VARCHAR(40),
CONSTRAINT [PK_Patient] PRIMARY KEY ([PatientNr])
)
GO
/* ---------------------------------------------------------------------- */
/* Add table "Diagnose" */
/* ---------------------------------------------------------------------- */
CREATE TABLE [Diagnose] (
[DiagnoseNr] INTEGER IDENTITY(1,1) NOT NULL,
[DiagnoseName] VARCHAR(60),
CONSTRAINT [PK_Diagnose] PRIMARY KEY ([DiagnoseNr])
)
GO
/* ---------------------------------------------------------------------- */
/* Add table "Konsultation" */
/* ---------------------------------------------------------------------- */
CREATE TABLE [Konsultation] (
[KonsultationNr] INTEGER IDENTITY(1,1) NOT NULL,
[ArztNr] INTEGER NOT NULL,
[PatientNr] INTEGER NOT NULL,
[DiagnoseNr] INTEGER NOT NULL,
[Datum] DATE,
CONSTRAINT [PK_Konsultation] PRIMARY KEY ([KonsultationNr])
)
GO
/* ---------------------------------------------------------------------- */
/* Foreign key constraints */
/* ---------------------------------------------------------------------- */
ALTER TABLE [Arzt] ADD CONSTRAINT [Ort_Arzt]
FOREIGN KEY ([OrtNr]) REFERENCES [Ort] ([OrtNr])
GO
ALTER TABLE [Konsultation] ADD CONSTRAINT [Arzt_Konsultation]
FOREIGN KEY ([ArztNr]) REFERENCES [Arzt] ([ArztNr])
GO
ALTER TABLE [Konsultation] ADD CONSTRAINT [Patient_Konsultation]
FOREIGN KEY ([PatientNr]) REFERENCES [Patient] ([PatientNr])
GO
ALTER TABLE [Konsultation] ADD CONSTRAINT [Diagnose_Konsultation]
FOREIGN KEY ([DiagnoseNr]) REFERENCES [Diagnose] ([DiagnoseNr])
GO

View File

@ -0,0 +1,16 @@
/* ---------------------------------------------------------------------- */
/* Script generated with: DeZign for Databases V7.2.0 */
/* Target DBMS: MS SQL Server 2012 */
/* Project file: ArztDatenbank.dez */
/* Project name: */
/* Author: */
/* Script type: Database drop script */
/* Created on: 2014-12-06 15:06 */
/* ---------------------------------------------------------------------- */
-- Delete all data
delete from [Konsultation];
delete from [Diagnose];
delete from [Arzt];
delete from [Patient];
delete from [Ort];

View File

@ -0,0 +1,116 @@
/* ---------------------------------------------------------------------- */
/* Script generated with: DeZign for Databases V7.2.0 */
/* Target DBMS: MS SQL Server 2012 */
/* Project file: ArztDatenbank.dez */
/* Project name: */
/* Author: */
/* Script type: Database drop script */
/* Created on: 2014-12-06 15:06 */
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
/* Select database */
/* ---------------------------------------------------------------------- */
use ArztDB;
/* ---------------------------------------------------------------------- */
/* Drop foreign key constraints */
/* ---------------------------------------------------------------------- */
IF OBJECT_ID (N'[Ort_Arzt]', N'F') IS NOT NULL
ALTER TABLE [Arzt] DROP CONSTRAINT [Ort_Arzt]
GO
IF OBJECT_ID (N'[Arzt_Konsultation]', N'F') IS NOT NULL
ALTER TABLE [Konsultation] DROP CONSTRAINT [Arzt_Konsultation]
GO
IF OBJECT_ID (N'[Patient_Konsultation]', N'F') IS NOT NULL
ALTER TABLE [Konsultation] DROP CONSTRAINT [Patient_Konsultation]
GO
IF OBJECT_ID (N'[Diagnose_Konsultation]', N'F') IS NOT NULL
ALTER TABLE [Konsultation] DROP CONSTRAINT [Diagnose_Konsultation]
GO
/* ---------------------------------------------------------------------- */
/* Drop table "Konsultation" */
/* ---------------------------------------------------------------------- */
/* Drop constraints */
IF OBJECT_ID (N'[PK_Konsultation]', N'PK') IS NOT NULL
ALTER TABLE [Konsultation] DROP CONSTRAINT [PK_Konsultation]
GO
/* Drop table */
IF OBJECT_ID (N'[Konsultation]', N'U') IS NOT NULL
DROP TABLE [Konsultation]
GO
/* ---------------------------------------------------------------------- */
/* Drop table "Diagnose" */
/* ---------------------------------------------------------------------- */
/* Drop constraints */
IF OBJECT_ID (N'[PK_Diagnose]', N'PK') IS NOT NULL
ALTER TABLE [Diagnose] DROP CONSTRAINT [PK_Diagnose]
GO
/* Drop table */
IF OBJECT_ID (N'[Diagnose]', N'U') IS NOT NULL
DROP TABLE [Diagnose]
GO
/* ---------------------------------------------------------------------- */
/* Drop table "Patient" */
/* ---------------------------------------------------------------------- */
/* Drop constraints */
IF OBJECT_ID (N'[PK_Patient]', N'PK') IS NOT NULL
ALTER TABLE [Patient] DROP CONSTRAINT [PK_Patient]
GO
/* Drop table */
IF OBJECT_ID (N'[Patient]', N'U') IS NOT NULL
DROP TABLE [Patient]
GO
/* ---------------------------------------------------------------------- */
/* Drop table "Arzt" */
/* ---------------------------------------------------------------------- */
/* Drop constraints */
IF OBJECT_ID (N'[PK_Arzt]', N'PK') IS NOT NULL
ALTER TABLE [Arzt] DROP CONSTRAINT [PK_Arzt]
GO
/* Drop table */
IF OBJECT_ID (N'[Arzt]', N'U') IS NOT NULL
DROP TABLE [Arzt]
GO
/* ---------------------------------------------------------------------- */
/* Drop table "Ort" */
/* ---------------------------------------------------------------------- */
/* Drop constraints */
IF OBJECT_ID (N'[PK_Ort]', N'PK') IS NOT NULL
ALTER TABLE [Ort] DROP CONSTRAINT [PK_Ort]
GO
/* Drop table */
IF OBJECT_ID (N'[Ort]', N'U') IS NOT NULL
DROP TABLE [Ort]
GO

View File

@ -0,0 +1,54 @@
/* ---------------------------------------------------------------------- */
/* Script generated with: DeZign for Databases V7.2.0 */
/* Target DBMS: MS SQL Server 2012 */
/* Project file: ArztDatenbank.dez */
/* Project name: */
/* Author: */
/* Script type: Database drop script */
/* Created on: 2014-12-06 15:06 */
/* ---------------------------------------------------------------------- */
-- Tabelle Ort
insert into [Ort] ([PLZ], [ORT])
values (8032, 'Zürich'),
(3003, 'Bern'),
(8000, 'Zürich'),
(1000, 'Lausanne');
-- Tabelle [Arzt]
insert into [Arzt] ([ArztNr], [ArztName], [OrtNr])
values (50001, 'Hans', 1),
(38494, 'Otto', 2),
(22978, 'Hyde', 3),
(61123, 'Hektor', 4);
-- Tabelle Patient
insert into [Patient] ([PatientNr], [PatientName])
values (1234, 'Monika'),
(0815, 'Anatol'),
(1112, 'Fabian'),
(4711, 'Bruno'),
(0007, 'James');
-- Tabelle Patient
insert into [Diagnose] ([DiagnoseName])
values ('Röteln'),
('Masern'),
('Angina'),
('Beinbruch'),
('Grippe'),
('Alzheimer');
-- Tabelle [Konsultation]
insert into [Konsultation] ([PatientNr], [ArztNr], [DiagnoseNr], [Datum])
values (1234, 50001, 1, convert(datetime, '1997.04.15', 102)),
(0815, 50001, 2, convert(datetime, '1997.04.17', 102)),
(1112, 50001, 3, convert(datetime, '1997.04.19', 102)),
(4711, 38494, 4, convert(datetime, '1997.04.22', 102)),
(0815, 38494, 5, convert(datetime, '1997.08.30', 102)),
(1234, 22978, 1, convert(datetime, '1997.05.21', 102)),
(0007, 22978, 6, convert(datetime, '1997.06.05', 102)),
(0007, 61123, 6, convert(datetime, '1997.07.02', 102)),
(1234, 61123, 3, convert(datetime, '1997.09.30', 102));