Assignment 5
Note: (Answers for question 1 to 5 should be written on paper and examples should executed on database)
1. What is join explain all types of joins in SQL.
2. What is Union and union all? Add the differences of them.
3. What is group by where we can use it?
4. Difference between where clause and having clause with example.
5. What is the use of foreign key and primary key?
6. Create the below student table.
ROLL_N SCIENC ENGLIS
O NAME MATHS E H
101 Asif 85 55 90
102 James 30 50 46
103 Karan 50 60 70
104 Rahul 75 90 61
105 Rajsekhar 95 50 80
106 Aditi 40 32 60
Output format:
ROLL_NO NAME GRADE MATHS GRADE SCIENCE GRADE ENGLISH
101 Asif First class
102 James
103 Karan
104 Rahul
105 Rajsekhar
106 Aditi
Grade in subject:
IF marks > 80 then First Class
IF marks > 60 AND =< 80 then Second Class
IF marks > 45 AND =< 60 then Third Class
IF marks > 34 AND =< 45 then Pass
Else fail