SQL-stellings
Knoppie [2.1.1 - iOS products]
SELECT DeviceID, DeviceName
FROM tblDevices
WHERE OperatingSystem = 'iOS'
Alternatief:
WHERE OperatingSystem LIKE 'iOS'
Knoppie [2.1.2 - Category selected]
SELECT DeviceName, Category, NumInStock
FROM tblDevices
WHERE Category LIKE '"%" + :DeviceType + '"'
Alternatief:
WHERE Category LIKE 'Smart' + :DeviceType + '"'
Anwaar ook QuotedStr
Knoppie [2.1.3 - Online support]
SELECT DeviceName, Category, OperatingSystem
FROM tblDevices D, tblManufacturers M
WHERE D.ManufacturerID = M.ManufacturerID
AND D.OnlineSupport = True
ORDER BY DeviceName
Knoppie [2.1.4 - Profit per manufacturer]
ORDER BY DeviceName
Knoppie [2.1.4 - Profit per manufacturer]
SELECT ManufacturerID,
FORMAT(SUM(NumInStock * Price * 0.6), "Currency") AS Profit
FROM tblDevices
GROUP BY ManufacturerID
Knoppie [2.1.5 - Remove devices]
DELETE FROM tblDevices
WHERE Category = 'Smart speaker' AND ManufacturerID = 'M104' - NSC Information Technology - Question 2 - 2023 - Paper 1
Question 2
SQL-stellings
Knoppie [2.1.1 - iOS products]
SELECT DeviceID, DeviceName
FROM tblDevices
WHERE OperatingSystem = 'iOS'
Alternatief:
WHERE OperatingSystem LIKE 'iOS... show full transcript
Worked Solution & Example Answer:SQL-stellings
Knoppie [2.1.1 - iOS products]
SELECT DeviceID, DeviceName
FROM tblDevices
WHERE OperatingSystem = 'iOS'
Alternatief:
WHERE OperatingSystem LIKE 'iOS'
Knoppie [2.1.2 - Category selected]
SELECT DeviceName, Category, NumInStock
FROM tblDevices
WHERE Category LIKE '"%" + :DeviceType + '"'
Alternatief:
WHERE Category LIKE 'Smart' + :DeviceType + '"'
Anwaar ook QuotedStr
Knoppie [2.1.3 - Online support]
SELECT DeviceName, Category, OperatingSystem
FROM tblDevices D, tblManufacturers M
WHERE D.ManufacturerID = M.ManufacturerID
AND D.OnlineSupport = True
ORDER BY DeviceName
Knoppie [2.1.4 - Profit per manufacturer]
ORDER BY DeviceName
Knoppie [2.1.4 - Profit per manufacturer]
SELECT ManufacturerID,
FORMAT(SUM(NumInStock * Price * 0.6), "Currency") AS Profit
FROM tblDevices
GROUP BY ManufacturerID
Knoppie [2.1.5 - Remove devices]
DELETE FROM tblDevices
WHERE Category = 'Smart speaker' AND ManufacturerID = 'M104' - NSC Information Technology - Question 2 - 2023 - Paper 1
Step 1
Knoppie [2.1.1 - iOS products]
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 find all iOS products from the tblDevices, you can write the following SQL query:
SELECT DeviceID, DeviceName
FROM tblDevices
WHERE OperatingSystem = 'iOS';
Alternatively, you could use the LIKE clause as shown below:
WHERE OperatingSystem LIKE 'iOS';
Step 2
Knoppie [2.1.2 - Category selected]
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 select the device name, category, and stock numbers where the category matches a specific DeviceType, use the following SQL query:
SELECT DeviceName, Category, NumInStock
FROM tblDevices
WHERE Category LIKE '"%" + :DeviceType + '"';
An alternative query can be written as follows:
WHERE Category LIKE 'Smart' + :DeviceType + '"';
Step 3
Knoppie [2.1.3 - Online support]
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 retrieve devices that support online transactions, the following query should be used:
SELECT DeviceName, Category, OperatingSystem
FROM tblDevices D, tblManufacturers M
WHERE D.ManufacturerID = M.ManufacturerID
AND D.OnlineSupport = True
ORDER BY DeviceName;
Step 4
Knoppie [2.1.4 - Profit per manufacturer]
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
To calculate the profit per manufacturer based on stock numbers and price, utilize this SQL query:
SELECT ManufacturerID,
FORMAT(SUM(NumInStock * Price * 0.6), 'Currency') AS Profit
FROM tblDevices
GROUP BY ManufacturerID;
Step 5
Knoppie [2.1.5 - Remove devices]
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 remove devices from the tblDevices, specifically those categorized as 'Smart speaker' from a certain manufacturer, the SQL command would be:
DELETE FROM tblDevices
WHERE Category = 'Smart speaker' AND ManufacturerID = 'M104';