Write SQL commands for the following on the basis of given table SPORTS:

Write SQL commands for the following on the basis of given table SPORTS:


student no. class name game1 grade1 game2 grade2
10 7 samir crickete b swimming a
11 8 sujit tennis a skating c
12 7 kamal swimming b football b
13 7 vinna tennis c tennis a
14 9 archana basketball a crickete a
15 10 arpita crickete a athletics c

(a) Display the names of the students who have grade 'C' in either Game1 or Game2 or both.     

 (b) Display the number of students getting grade 'A' in Cricket. 
     
(c) Display the name of the students who have same grade for both Game1 and Game2. 

(d) Arrange the whole table up by the students, whose name starts with 'A'. 

 Ans.

 (a) Select Name          
 From SPORTS            
Where Grade1"C" OR Grade2"C";     

       
(b) Select Count (*)          
 From SPORTS        
  Where (Grade1"A" AND Game1"Cricket")  

OR (Grade2"A" AND Game2"Cricket") 


 (c) Select Name
From SPORTS  
Where Game1 = Game 2;


  (d) Select Game1, Game 2
 From SPORTS
Where Name like "A%";

1 Comments

Post a Comment

Previous Post Next Post