2.1 SQL-stellings
2.1.1 Knoppie [2.1.1 - Free videos]
SELECT Title, Duration, UploadDate, CreatorID
FROM tbVideos
WHERE FreeVideo = True
2.1.2 Knoppie [2.1.2 - Check domain]
SELECT CreatorName, Email, Country
FROM tbCreators
WHERE NOT Email LIKE "%gmail%" AND
Country = "South Africa"
2.1.3 Knoppie [2.1.3 - Latest videos]
SELECT Top 3 UploadDate, VideoID, Title
FROM tbVideos
ORDER BY UploadDate DESC
2.1.4 Knoppie [2.1.4 - Videos per creator]
SELECT CreatorID,
Count(*) AS [Number of videos]
FROM tbVideos
GROUP BY CreatorID
HAVING Count(*) > 5
2.1.5 Knoppie [2.1.5 - Add new creator]
INSERT INTO tbCreators
VALUES ('Trish', 'TRISHKALM', 'trish@srmarketing.co.za', 'South Africa')
2.2 Databasismanipulasie
2.2.1 Knoppie [2.2.1 - Remove creator]
Ga aan die eerste rekord in tbCreators
Stap met lus ('loop') deur tbCreators
Toets of tbCreators['CreatorName'] = 'CreatorName'
Gaan na die eerste rekord in tbVideos
Stap met lus ('loop') deur tbVideos
Toets of (tbCreators['CreatorID'] = tbVideos['CreatorID'])
tbVideos.Delete
anders
2.2.2 Knoppie [2.2.2 - Change upload date]
As die datum vars uit die videos gewys word, moet die
UploadDate neergeskryf word in
tbVideos.Edit;
tbVideos['UploadDate'] := Date;
tbVideos.Post; - NSC Information Technology - Question 2 - 2024 - Paper 1
Question 2
2.1 SQL-stellings
2.1.1 Knoppie [2.1.1 - Free videos]
SELECT Title, Duration, UploadDate, CreatorID
FROM tbVideos
WHERE FreeVideo = True
2.1.2 Knoppie [2.1.2 - Che... show full transcript
Worked Solution & Example Answer:2.1 SQL-stellings
2.1.1 Knoppie [2.1.1 - Free videos]
SELECT Title, Duration, UploadDate, CreatorID
FROM tbVideos
WHERE FreeVideo = True
2.1.2 Knoppie [2.1.2 - Check domain]
SELECT CreatorName, Email, Country
FROM tbCreators
WHERE NOT Email LIKE "%gmail%" AND
Country = "South Africa"
2.1.3 Knoppie [2.1.3 - Latest videos]
SELECT Top 3 UploadDate, VideoID, Title
FROM tbVideos
ORDER BY UploadDate DESC
2.1.4 Knoppie [2.1.4 - Videos per creator]
SELECT CreatorID,
Count(*) AS [Number of videos]
FROM tbVideos
GROUP BY CreatorID
HAVING Count(*) > 5
2.1.5 Knoppie [2.1.5 - Add new creator]
INSERT INTO tbCreators
VALUES ('Trish', 'TRISHKALM', 'trish@srmarketing.co.za', 'South Africa')
2.2 Databasismanipulasie
2.2.1 Knoppie [2.2.1 - Remove creator]
Ga aan die eerste rekord in tbCreators
Stap met lus ('loop') deur tbCreators
Toets of tbCreators['CreatorName'] = 'CreatorName'
Gaan na die eerste rekord in tbVideos
Stap met lus ('loop') deur tbVideos
Toets of (tbCreators['CreatorID'] = tbVideos['CreatorID'])
tbVideos.Delete
anders
2.2.2 Knoppie [2.2.2 - Change upload date]
As die datum vars uit die videos gewys word, moet die
UploadDate neergeskryf word in
tbVideos.Edit;
tbVideos['UploadDate'] := Date;
tbVideos.Post; - NSC Information Technology - Question 2 - 2024 - Paper 1
Step 1
Knoppie [2.1.1 - Free videos]
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To retrieve the details of free videos, execute the SQL statement:
SELECT Title, Duration, UploadDate, CreatorID
FROM tbVideos
WHERE FreeVideo = True;
Step 2
Knoppie [2.1.2 - Check domain]
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To check for creators with specific email domains, execute:
SELECT CreatorName, Email, Country
FROM tbCreators
WHERE NOT Email LIKE "%gmail%" AND
Country = 'South Africa';
Step 3
Knoppie [2.1.3 - Latest videos]
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To select the latest videos, use:
SELECT TOP 3 UploadDate, VideoID, Title
FROM tbVideos
ORDER BY UploadDate DESC;
Step 4
Knoppie [2.1.4 - Videos per creator]
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
For counting the number of videos per creator, apply:
SELECT CreatorID,
COUNT(*) AS [Number of videos]
FROM tbVideos
GROUP BY CreatorID
HAVING COUNT(*) > 5;
Step 5
Knoppie [2.1.5 - Add new creator]
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To add a new creator, execute the following:
INSERT INTO tbCreators
VALUES ('Trish', 'TRISHKALM', 'trish@srmarketing.co.za', 'South Africa');
Step 6
Knoppie [2.2.1 - Remove creator]
97%
121 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
For removing a creator from the database, implement:
Loop through tbCreators to find the record of the creator to remove.
Check if tbCreators['CreatorName'] = 'CreatorName'.
Use that identifier to remove corresponding records in tbVideos.
Ensure to delete entries in tbVideos before finalizing deletion in tbCreators.
Step 7
Knoppie [2.2.2 - Change upload date]
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To update an upload date, utilize:
UPDATE tbVideos
SET UploadDate = CURRENT_DATE
WHERE VideoID = 'specific_video_id';