2024-06-04
Max. 100 points
Name:
Task | Max. | Achieved |
---|---|---|
1 | 20 | |
2 | 10 | |
3 | 15 | |
4 | 25 | |
5 | 30 | |
Sum | 100 |
To solve the tasks in this test, use the following ERD. Use SQL syntax
that works in either SQLite or PostgreSQL.
Add the following data to your database.
classes |
||
---|---|---|
class_id |
name |
year |
1 | 2AKIFT | 2023 |
2 | 4BHEL | 2023 |
3 | 6ACELI | 2023 |
students |
||
---|---|---|
student_id |
full_name |
class_id |
1 | Pat Miller | 1 |
2 | Chris Surströmming | 2 |
insert into classes (name, year) values
('2AKIFT', 2023),
('4BHEL', 2023),
('6ACELI', 2023);
insert into students (full_name, class_id) values
('Pat Miller', 1),
('Chris Surströmming', 2);
delete from students where full_name = 'Pat Miller';
class_id=1
to 2022.
(15 points)update classes set year = 2022 where class_id = 1;
select full_name, email from students
natural join classes
where classes.name = '4BHEL' and classes.year = 2023
order by students.full_name;
%
select * from students
natural join classes
where students.full_name like 'F%'
order by classes.name
limit 5;