GFC Query Script
GFC Query Script
GO
IF EXISTS (SELECT name FROM sys.sysdatabases
WHERE name = 'GrandfieldCollege')
DROP DATABASE GranfieldCollege
GO
CREATE DATABASE GrandfieldCollege
GO
USE GrandfieldCollege
GO
Use GrandfieldCollege
GO
CREATE TABLE License
(
LicenseKey int Primary Key Not Null,
LicenseType NVarChar Not Null,
LicenseStart Date Not Null,
LicenseTerm NVarChar Not Null,
LicenseEnd Date Not Null,
LicenseRegistrationKey nvarchar(50) Not Null,
)
GO
CREATE TABLE Software
(
SoftwareKey int Primary Key Not Null,
SoftwareName NVarChar Not Null,
SoftwareVersion NVarChar Not Null,
SoftwareManufacturer NVarChar Not Null,
SoftwareInstallType NVarChar Not Null,
SoftwareLicence NVarChar Not Null,
LicenseKey int Not Null,
CONSTRAINT fk_License FOREIGN KEY(LicenseKey)
REFERENCES License(LicenseKey),
)
GO
CREATE TABLE Install
(
InstallKey int Primary Key Not Null,
InstallDate datetime Not Null,
InstallMachine NVarChar Not Null,
InstallSoftware NVarChar Not Null,
InstallSuccesful NVarChar Not Null,
SoftwareKey int Not Null,
CONSTRAINT fk_Software FOREIGN KEY(SoftwareKey)
REFERENCES Software (SoftwareKey),
)
GO
CREATE TABLE Location
(
LocationKey Nvarchar Not Null Primary Key,
BuildingName nvarchar(50) Not Null,
BuildingRoom Nvarchar (50) Not Null,
)
GO
CREATE TABLE Machine
(
MachineCSS int Primary Key Not Null,
MachineInstalledPrograms NvarChar Not Null,