Upload project.

This commit is contained in:
StevenJW
2020-06-07 22:29:59 +01:00
parent dd854dad2c
commit c0d3f8b07a
66 changed files with 729 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
CREATE PROCEDURE UpdateUserName @OldName varchar(255), @NewName varchar(255)
AS
UPDATE Users
SET UserName = @NewName, LikeCount = 0
WHERE UserName = @OldName
GO

View File

@@ -0,0 +1,15 @@
INSERT INTO MediaEntry(CategoryID, UserID, ProductionID, Title, EntryDescription, UploadDate, Premium)
VALUES
(3, 5, NULL, 'INSERT TEST', 'INSERT TEST', '2018-09-09 08:23:00', 0)
INSERT INTO VideoEntry(EntryID, EncodeID, FileTypeID, AiredTypeID, VideoFileName, AiredOn, Length)
VALUES
(18, 6, 4, 2, 'TEST', '1968-09-27', 9180)
INSERT INTO ImageEntry(EntryID, FileTypeID, ImageFileName, Height, Width)
VALUES
(18, 1, 'TEST', 500, 500)
INSERT INTO ContentPage(EntryID, Likes, Dislikes)
VALUES
(18, 0, 0)

View File

@@ -0,0 +1,17 @@
CREATE PROCEDURE RemoveMediaEntry @EntryID integer
AS
DELETE FROM ImageEntry
WHERE EntryID = @EntryID;
DELETE FROM AudioEntry
WHERE EntryID = @EntryID;
DELETE FROM VideoEntry
WHERE EntryID = @EntryID;
DELETE FROM Thumbnail
WHERE EntryID = @EntryID;
DELETE FROM Comment
WHERE PageID = @EntryID;
DELETE FROM ContentPage
WHERE PageID = @EntryID;
DELETE FROM MediaEntry
WHERE EntryID = @EntryID;
GO

View File

@@ -0,0 +1,7 @@
INSERT INTO VideoEntry(EntryID, EncodeID, FileTypeID, AiredTypeID, VideoFileName, AiredOn, Length)
VALUES
(1, 6, 4, 2, 'ENTRY 1', '2000-08-22', 2934)
INSERT INTO VideoFileTypes(TypeName, TypeExtension, Codec)
VALUES
('NEW TYPE', 'NEW TYPE', 'NEW TYPE')

View File

@@ -0,0 +1,9 @@
CREATE PROCEDURE RemoveUser @UserID integer
AS
DELETE FROM RoleAllocation
WHERE UserID = @UserID;
DELETE FROM ProfilePicture
WHERE UserID = @UserID;
DELETE FROM Comment
WHERE UserID = @UserID;
GO

5
SQL/queries/query 1.sql Normal file
View File

@@ -0,0 +1,5 @@
SELECT UserName, RoleName
FROM Users
LEFT JOIN RoleAllocation ON RoleAllocation.UserID = Users.UserID
LEFT JOIN Roles ON Roles.RoleID = RoleAllocation.RoleID
WHERE Users.UserId = 1

5
SQL/queries/query 2.sql Normal file
View File

@@ -0,0 +1,5 @@
SELECT UserName, LikeCount, UserDescription, PictureFileName, Height, Width, Content
FROM Users
LEFT JOIN ProfilePicture ON ProfilePicture.UserID = Users.UserID
LEFT JOIN Comment ON Comment.UserID = Users.UserID
WHERE Users.UserID = 1

11
SQL/queries/query 3.sql Normal file
View File

@@ -0,0 +1,11 @@
SELECT Title, EntryDescription, UploadDate, ProductionName, CategoryName, ThumbnailFileName, Likes, Dislikes, Content, ParentComment, VideoFileName, AudioFileName, ImageFileName
FROM MediaEntry
LEFT JOIN Production ON Production.ProductionID = MediaEntry.ProductionID
LEFT JOIN Category ON Category.CategoryID = MediaEntry.CategoryID
LEFT JOIN ContentPage ON ContentPage.EntryID = MediaEntry.EntryID
LEFT JOIN Comment ON Comment.PageID = ContentPage.PageID
LEFT JOIN Thumbnail ON Thumbnail.EntryID = MediaEntry.EntryID
LEFT JOIN VideoEntry ON VideoEntry.EntryID = MediaEntry.EntryID
LEFT JOIN AudioEntry ON AudioEntry.EntryID = MediaEntry.EntryID
LEFT JOIN ImageEntry ON ImageEntry.EntryID = MediaEntry.EntryID
WHERE MediaEntry.EntryID = 1

11
SQL/queries/query 4.sql Normal file
View File

@@ -0,0 +1,11 @@
SELECT Title, EntryDescription, UploadDate, ProductionName, CategoryName, VideoEntry.VideoFileName, VideoPreview.VideoFileName, AudioEntry.AudioFileName, AudioPreview.AudioFileName, ImageFileName
FROM MediaEntry
LEFT JOIN Production ON Production.ProductionID = MediaEntry.ProductionID
LEFT JOIN Category ON Category.CategoryID = MediaEntry.CategoryID
LEFT JOIN VideoEntry ON VideoEntry.EntryID = MediaEntry.EntryID
--Include previews
LEFT JOIN VideoPreview ON VideoPreview.VideoID = VideoEntry.VideoID
LEFT JOIN AudioEntry ON AudioEntry.EntryID = MediaEntry.EntryID
LEFT JOIN AudioPreview ON AudioPreview.AudioID = AudioEntry.AudioID
LEFT JOIN ImageEntry ON ImageEntry.EntryID = MediaEntry.EntryID
WHERE MediaEntry.UserID = 1

12
SQL/queries/query 5.sql Normal file
View File

@@ -0,0 +1,12 @@
SELECT Title, EntryDescription, UploadDate, ProductionName, CategoryName, VideoEntry.VideoFileName, VideoPreview.VideoFileName AS VideoPreviewName, AudioEntry.AudioFileName, AudioPreview.AudioFileName AS AudioPreviewName, ImageFileName, UserName
FROM MediaEntry
LEFT JOIN Users ON Users.UserID = MediaEntry.UserID
LEFT JOIN Production ON Production.ProductionID = MediaEntry.ProductionID
LEFT JOIN Category ON Category.CategoryID = MediaEntry.CategoryID
LEFT JOIN VideoEntry ON VideoEntry.EntryID = MediaEntry.EntryID
--Include previews
LEFT JOIN VideoPreview ON VideoPreview.VideoID = VideoEntry.VideoID
LEFT JOIN AudioEntry ON AudioEntry.EntryID = MediaEntry.EntryID
LEFT JOIN AudioPreview ON AudioPreview.AudioID = AudioEntry.AudioID
LEFT JOIN ImageEntry ON ImageEntry.EntryID = MediaEntry.EntryID
WHERE MediaEntry.UploadDate BETWEEN '2018-09-10 02:33:13' AND '2018-09-10 12:52:00'