Get the step-by-step solution for this question inside the Vidyadip app.
Get the answer in the appGenerate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.
Consider the following table Student & Stream.
Table: Student
| Admno | Sname | Class | Sec | Fee | Mobile | Area | S_ID |
| 1001 | RAMESH | XII | A | 2500 | 987654321 | Madipur | 10 |
| 1078 | KRISHNA | XII | B | 2400 | 999911111 | Jawala Heri | 30 |
| 1006 | FARDEEN | XII | C | 2600 | 987654321 | Paschim Puri | 40 |
| 1004 | SUBHAM | XII | A | 2500 | 963025874 | Madipur | 20 |
| 1029 | KRITIKA | XI | C | 2700 | 987456210 | Madipur | 30 |
| 1008 | SAMEEKSHA | XII | A | 2450 | 987123456 | Mangol Puri | 20 |
| 1025 | SALMA | XII | B | 2580 | 998877445 | Madipur | 30 |
| 1036 | AMANDEEP | XII | B | 2600 | 999333555 | Khyala | 40 |
| 1037 | TEJAS | XI | C | 2650 | 987951357 | Paschim Puri | 40 |
| 1029 | HIMANSHU | XII | A | 2750 | 951369874 | Jawala Heri | 10 |
Table : Stream
| S_ID | Stream_name |
| 10 | MEDILCAL |
| 20 | NON MEDICAL |
| 30 | COMMERCE WITH MATH |
| 40 | COMMERCE WITH IP |
| 50 | HUMANITIES |
Write SQL commands for the statements (a) to (h) on the table: Student and Stream
(a) Display class and total fee collected from each class.
(b) Display admission no, students name and stream name.
(c) Display all the student details who have taken Commerce Stream.
(d) Count number of students who have opted for HUMANITIES stream.
(e) Display information of commerce with ip students whose name start with ‘S’. Arrange the record by admission number.
(f) Display details of all students who are in the MEDICAL stream.
(g) Display total fee of ‘Non-Medical’ Student.
(h) Change the name of the Column Sname to Student_Name.
Table: Trainer
| TID | Tname | City | HireDate | Salary |
| 101 | Sunaina | Mumbai | 1998-10-15 | 90000 |
| 102 | Anamika | Delhi | 1994-12-24 | 80000 |
| 103 | Deepti | Chandigarh | 2001-12-21 | 82000 |
| 104 | Meenakshi | Delhi | 2002-12-25 | 78000 |
| 105 | Richa | Mumbai | 1996-01-12 | 95000 |
| 106 | Maniprabha | Chennai | 2001-12-12 | 69000 |
Table: Course
| CID | CNAME | FEES | STARTDATE | TID |
| C201 | AGDCA | 12000 | 2018-07-02 | 101 |
| C202 | ADCA | 15000 | 2018-07-15 | 103 |
| C203 | DCA | 10000 | 2018-10-01 | 102 |
| C203 | DDTP | 9000 | 2018-09-15 | 104 |
| C205 | DHN | 20000 | 2018-08-01 | 101 |
| C206 | O LEVEL | 18000 | 2018-07-25 | 105 |
(a) Display the Trainer Name, City and Salary in descending order of their hire date.
(b) To display the TNAME and CITY of Trainer of joined the institute in the month of December 2001.
(c) To display TNAME, HIREDATE,CNAME, STARTDATE from tables TRAINER and COURSE whose FEES is less than or equal to 10000
(d) To display number of trainer from each city
(e) select tid, tname,from trainer where city not in(‘delhi’,’mumbai’);
(f) select distinct tid from course;
(g) select tid , count (*), min(fees) from course group by tid having count(*)>1;
(h) Select count(*),sum(fees) from course where startdate <’2018-09-15’;
(a) Using the three separate words "We,""study,"and "MySQL,"produce the following output: "We study MySQL "
(b) Use the string "Internet is a boon "and extract the string "net ".
(c) Display the length of the string "Informatics Practices ".
(d) Display the position of "My "in "Enjoying MySQL ".
(e) Display the name of current month.