The database ShoppingMallID contains information on different types of shops in a shopping mall and the details of the managers of the shops - NSC Information Technology - Question 2 - 2021 - Paper 1
Question 2
The database ShoppingMallID contains information on different types of shops in a shopping mall and the details of the managers of the shops. The database contains t... show full transcript
Worked Solution & Example Answer:The database ShoppingMallID contains information on different types of shops in a shopping mall and the details of the managers of the shops - NSC Information Technology - Question 2 - 2021 - Paper 1
Step 1
Button [2.1.1 - List of shops]
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 display all fields of the shops in the tblShops table sorted from largest to smallest according to the ShopSize field, you can use the following SQL statement:
SELECT * FROM tblShops
ORDER BY ShopSize DESC;
Step 2
Button [2.1.2 - Manager number]
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
The SQL query to retrieve the shop name and manager number sorted by ShopSize is:
SELECT ShopName
FROM tblShops
ORDER BY ShopSize DESC;
Step 3
Button [2.1.3 - Rental > R50 000]
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 calculate the rental costs for each shop and display only the shops with a rental greater than R50,000, the SQL query would be:
SELECT ShopName, ShopSize, FORMAT(65 * ShopSize, 'Currency') AS Rental
FROM tblShops
WHERE 65 * ShopSize > 50000;
Step 4
Button [2.1.5 - Update shop name]
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 update the relevant record, changing the shop name from 'Jeans 4U' to 'TeenDream', use the following SQL statement:
UPDATE tblShops
SET ShopName = 'TeenDream'
WHERE ShopName = 'Jeans 4U';