I'm trying to do a simple a database SQL script where I simply need tocreate a database as well as 4 tables within. So far I'm getting a very annoying error that states: There is already an object named 'DEVICE_TYPE' in the database. Why, I don't know? Any help regarding this matter will be highly appreciated.
Please see the code below:
DROP Database EliteShop
GO
CREATE Database EliteShop
GO
USE EliteShop
GO
CREATE TABLE DEVICE_TYPE
(
Device_TypeID INT IDENTITY(1,1),
Device_TypeID_Name VARCHAR(50),
CONSTRAINT pk_devicetype PRIMARY KEY(Device_TypeID)
)
CREATE TABLE MANUFACTURER
(
Manufacturer_Code VARCHAR(50),
Manufacturer_Description VARCHAR(100),
CONSTRAINT pk_manufacturercode PRIMARY KEY(Manufacturer_Code)
)
CREATE TABLE [PLATFORM]
(
PlatformID INT IDENTITY(1,1),
Platform_Description VARCHAR(50),
CONSTRAINT pk_platID PRIMARY KEY(PlatformID)
)
CREATE TABLE DEVICE
(
DeviceID INT IDENTITY(1,1),
Device_TypeID INT,
PlatformID INT,
Manufacturer_Code VARCHAR(50),
Model VARCHAR(50),
InternalMemory VARCHAR(10),
Price MONEY,
CONSTRAINT pk_deviceID PRIMARY KEY (DeviceID),
CONSTRAINT fk_deviceType FOREIGN KEY (Device_TypeID) REFERENCES DEVICE_TYPE(Device_TypeID),
CONSTRAINT fk_manuFCode FOREIGN KEY (Manufacturer_Code) REFERENCES MANUFACTURER(Manufacturer_Code),
CONSTRAINT fk_myPlatID FOREIGN KEY (PlatformID) REFERENCES [PLATFORM](PlatformID)
)