ExerciseSeries1-SQL at A Glance
ExerciseSeries1-SQL at A Glance
3. Create the database myfilms. View the database in the Object Browser.
insert into myfilms.films (title, year, score) values ('The Da Vinci Code',
2006, 4.2);
insert into myfilms.films (title, year, score) values ('The Circle', 2017, 4);
insert into myfilms.films (title, year, score) values ('The Professor and the
Madman', 2019, 3.9);
select *
from myfilms.films
update myfilms.films
set score = 4.1
where title='The Professor and the Madman'
CREATE TABLE actors ( actorid INT NOT NULL AUTO_INCREMENT PRIMARY
KEY, lastname CHAR(45) NOT NULL, firstname CHAR(30) NOT NULL, birthdate
DATE, )
UPDATE actors
SET birthdate = '1939-05-25'
WHERE firstname = 'Ian' AND lastname = 'McKellen';
SELECT *
FROM players
ORDER BY filmid
15. Add the next row to the table players. This does not work: explain the error message.
filmid actorid
1 (The Da Vinci Code) 55
16. Add the next row to the table players. This doesn't work either: explain.
filmid actorid
88 2
17. Add the next row to the table players. Explain why this doesn't work.
filmid actorid
2 5
18. Add the next row to the table actors. Explain why this doesn't work.
actorid Lastname firstname birthdate
9 Carter
SELECT films.*, actors.* FROM films JOIN players ON films.filmid = players.filmid JOIN
actors ON players.actorid = actors.actorid ORDER BY score
20. In preparation for the following work seminars: register on SQL SPOJ with your Howest
email address and a specific password for SQL SPOJ. Note: when using SQL SPOJ at
home, first make a VPN connection.
http://sqlspoj.ti.howest.be/ or http://172.21.22.52