Consider the following relational schema:
The underlined attributes indicate the primary keys for the relations. The ‘year’ attribute for the STUDENTS relation indicates the year in which the student is currently studying (First year, Second year etc.)
Write a relational algebra query to print the roll number of students who have registered for cno 322.
Write a SQL query to print the age and year of the youngest student in each year.
GROUP BY year
in second question we hav to find year nd youngest student from that year so, we have to apply minn aggregate function on group of year
I have doubt in REGISTERED FOR Table. Cno is primary key, it means a course can be enrolled only by one student??
The above may be useful.
What would be the query if i need "sname,age,year" of the youngest student in each year.
i tried below, but this is wrong
SELECT SNAME,YEAR,MIN(AGE) FROM STUDENTS GROUP BY YEAR,SNAME;
1). (a)πroll_no.(σcno.=322(registered for))
2.) select age , year from student s1 where not exists(select s2.age from student s2 where s2.age > s1.age) group by year.