Student Table and SQL Queries
Student Table and SQL Queries
Student Table
Output:
|---------|-------|-------|-------------|-----------|-------------|-----------|
SQL Command: SELECT RollNo, Name FROM Student WHERE Subject1 = 'Mathematics';
Output:
| Roll No | Name |
|---------|---------|
| 101 | Alice |
| 103 | Charlie |
| 104 | Diana |
| 105 | Ethan |
SQL Command: SELECT Class, COUNT(*) AS StudentCount FROM Student GROUP BY Class;
Output:
| Class | StudentCount |
|-------|--------------|
| 11 |2 |
| 12 |3 |
Query: Retrieve the name and roll number of students studying 'Physics' in Subject 2.
SQL Command: SELECT RollNo, Name FROM Student WHERE Subject2 = 'Physics';
Output:
| Roll No | Name |
|---------|-------|
| 101 | Alice |
| 102 | Bob |
| 104 | Diana |
UNION
UNION
UNION
Output:
| Subject |
|---------------|
| Mathematics |
| Biology |
| Physics |
| Chemistry |
| Computer |
| History |
| Geography |
| English |