непонятна гешка в judge при създаване на база данни
Incorrect syntax near the keyword 'USE'.
Database 'Movies' does not exist. Make sure that the name is entered correctly.
кода е:
CREATE DATABASE [Movies]
GO
USE [Movies]
GO
CREATE TABLE Directors (
Id INT PRIMARY KEY IDENTITY NOT NULL,
DirectorName NVARCHAR(100) NOT NULL,
Notes NVARCHAR (MAX)
)
CREATE TABLE Genres (
Id INT PRIMARY KEY IDENTITY NOT NULL,
GenreName NVARCHAR (30) NOT NULL,
Notes NVARCHAR (MAX)
)
CREATE TABLE Categories (
Id INT PRIMARY KEY IDENTITY NOT NULL,
CategoryName NVARCHAR (50) NOT NULL,
Notes NVARCHAR (MAX)
)
CREATE TABLE Movies (
Id INT PRIMARY KEY IDENTITY NOT NULL,
Title NVARCHAR (50) NOT NULL,
DirectorId INT FOREIGN KEY REFERENCES Directors(Id),
CopyrightYear DATE,
[Length] BIGINT,
GenreId INT FOREIGN KEY REFERENCES Genres(Id),
Rating INT,
Notes NVARCHAR (MAX)
)
INSERT INTO Directors (DirectorName, Notes) VALUES
('ytyr', 'rwerwee'),
('tryy', 'sddffghgh'),
('gdffg', 'tyuyuyuy'),
('ertrt', 'gdffdfdf'),
('uiouioi', 'ertrtwerwr')
INSERT INTO Genres(GenreName, Notes) VALUES
('ffffff', 'erwerwerwe'),
('rrrrrr', 'fgdfgdfgfg'),
('yyyyy', 'erwerrers'),
('ioioioi', 'ghgjjhkjhk'),
('eeeeeeeee', 'werwerer')
INSERT INTO Categories(CategoryName, Notes) VALUES
('uuuuuuuuuu', 'pppppppppppp'),
('iiiiiiiiii', 'llllllllll'),
('ooooooo', 'ttttttt'),
('eeeeeeeee', 'wwwwwwwwwwwww'),
('zzzzzzzzzz', 'jjjjjjjjjjj')
INSERT INTO Movies (Title, DirectorId, CopyrightYear, [Length], GenreId, Rating, Notes) VALUES
('ab', 2, '1978', '100', 3, 10, 'mmmmmmm')
,('as', 5, '1998', '120', 5, 10, 'nnnnnnnnnnnnn')
,('ad', 1, '2005', '141', 3, 1, 'bbbbbbbbbbb')
,('ar', 4, '2009', '222', 4, 3, 'vvvvvvvvvvv')
,('aw', 3, '2010', '111', 1, 9, 'ddddddddddd')
Благодаря