SQL
SQL
[2]
(ii) Write an SQL query that finds the name and presenter of all videos on the Topic of “The CPU”.
[4]
All pages in the site contain the following tag in the head section.
The exam board wants to use a database to keep track of which videos each student has viewed. The structure
it plans to use is shown below:
(i) Identify one reason why this structure would not be suitable.
[1]
[3]
For example, the product which has ProductId 12345 is a large bench which has a price of £150.
[2]
Describe the purpose of this code and give one situation in which it may be used.
[5]
The forum stores details of its users in the table called Users. An extract of Users is shown below.
1 Zeus 8dfa46a79248037752bba6166fcb34f8 1
2 Hera 74d39d60507eb55e000c6ec5c1265891 0
3 Poseidon b015d770d0208ddcce2c2c719fe29371 0
Describe what is meant by the term ‘primary key’, giving an example from the table above.
[2]
[1]
[2]
[3]
(d)
Sometimes users can have their accounts locked if they behave inappropriately. When this is the case the
locked field is set to 1 rather than 0.
Write an SQL statement that locks the account of the user Hades
[3]
passwordHash and locked have already been extracted from the database before being passed to the
function. It should return the value true if a user should be allowed access to a system and false if they aren’t.
Your function should make use of the pre-written function hash() which takes in a string and returns the hash
of that string.
e.g.
[5]
[2]
(ii) Explain why the programmers have chosen to store the user's IP address.
[2]
State what the value of statement would be after line 03 of the code in Fig. 8 .1 is run.
[1]
(ii) State what the value of hashInDB would be after line 04 of the code in Fig. 8.1 is run.
[1]
The username DenverJ34'; DROP TABLE users; –– is entered into the form.
(i) State what the value of statement would be after line 03 is run.
[1]
[2]
(iii) State the name of a law the user has broken by entering the username
DenverJ34'; DROP TABLE users; --
[1]
[2]
The SQL statement below shows all the data for flights going to Halifax. Rewrite it so it instead removes all
flights to Heathrow on 4th July 2018.
[3]
Total 10
Total 7
Examiner’s Comments
Well received and answered by most
candidates.
c SELECT passwordHash, locked (1) 3 Do not award first mark for SELECT *
FROM Users (1)
WHERE username=‘Apollo’ (1) (AO 3.2)
Examiner’s Comments
In most cases, candidates who achieved
marks in c) went on to achieve marks in d)
with few candidates achieving all marks in
either. Many candidates did not use correct
SQL statement structure or syntax e.g.
confusing attribute names with string
literals.
Examiner’s Comments
In most cases, candidates who achieved
marks in c) went on to achieve marks in d)
with few candidates achieving all marks in
either. Many candidates did not use correct
SQL statement structure or syntax e.g.
confusing attribute names with string
literals.
Total 15
ii 0e5a511 1
Total 15
Examiner’s Comments
Total 5