हिंदी

Given the following tables: Table: STUDENTS S_ID NAME AGE CITY, 1, Rahul, 20, Delhi, 2 Priya 22 Mumbai, 3 David 21 Delhi, 4 Neha 23 Bengaluru, 5, Khurshid, 22, Delhi - Informatics Practices

Advertisements
Advertisements

प्रश्न

Given the following tables:

Table: STUDENTS

S_ID NAME AGE CITY
1 Rahul 20 Delhi
2 Priya 22 Mumbai
3 David 21 Delhi
4 Neha 23 Bengaluru
5 Khurshid 22 Delhi

Table: GRADES

S_ID SUBJECT GRADE
1 Math A
2 English B
3 Math C
4 English D
5 Math E

Write SQL queries for the following:

  1. To display the number of students from each city.
  2. To find the average age of all students.
  3. To list the names of students and their grades.
कोड लेखन
Advertisements

उत्तर

  1. SELECT CITY, COUNT(*) FROM STUDENTS GROUP BY CITY;
  2. SELECT AVG(AGE) FROM STUDENTS;
  3. SELECT S.NAME, G.GRADE FROM STUDENTS S JOIN GRADES G ON S.S _ ID = G.S _ ID;
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2024-2025 (March) Set 4

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×