Which of the following SQL statements could you use If you want to select the username, e-mail and postcode fields from a table named ‘users’?
SELECT users FROM username, e-mail, postcode;
SELECT username, email, postcode FROM users;
FROM users SELECT username, email, postcode;
Which of the following would be returned if this command were executed?
SELECT PupilID, Surname, Class FROM Pupil
WHERE Class = ‘1T1’;
The pupil field from the PupilID, Surname and Class tables, where the class in each table is 1T1
The value 1T1, if it appears in either the PupilID, Surname or Class fields within the pupil table
Data held in the PupilID, Surname and Class fields from the pupil table where the class field holds the value 1T1
Which SQL keyword is used to return results in a specific order?
IN ORDER
SET ORDER
ORDER BY
What would need to be added to this SQL example to sort the data by class in ascending order and merit points in descending order?
ORDER BY class ASC, merit points ASC;
ORDER BY class ASC, merit points DESC;
ORDER by merit points DESC, class ASC;
What would happen if this SQL command were used?
UPDATE Pupil
SET Pastrol Care Teacher = ‘Mr Gilchrist’
WHERE Pastoral Care Teacher = ‘Miss Armstrong’;
All data in the pastoral care field would be updated to now hold Mr Gilchrist, apart from fields that contain Miss Armstrong
Fields currently containing Miss Armstrong would be updated to now hold Mr Gilchrist
Fields currently containing Mr Gilchrist would be updated to now hold Miss Armstrong
What would the wildcard ‘Da%’ return?
The percentage of data that has ‘Da’ in it
All data that starts with ‘Da’
All data that ends with ‘Da’
Which of the following aggregate functions could be used to show how often something occurs in a database?
AVG ( )
MAX ( )
COUNT ( )
What field is most likely to be a computed field with an alias in the following table?
(a)
(b)
(c)