High School

Write SQL queries for the following based on the below given COURSE table:

| COURSEID | COURSE_NAME | FEES | STRENGTH |
| -------- | ----------- | ------ | -------- |
| C001 | B.TECH | 500000 | 240 |
| C002 | BCA | 275000 | 120 |
| C003 | MBA | 425000 | 120 |
| C004 | BBA | 250000 | 180 |
| C005 | DESIGN | 175000 | 60 |

(a) Update the Strength to 180 for CourseID C001.
(b) Display the details of MBA Course.

Answer :

Here's how you can write SQL queries for the given tasks based on the COURSE table described:

(a) Update the Strength to 180 for CourseID C001:

To update the STRENGTH of the course with CourseID C001, you can use the UPDATE statement in SQL. This changes the STRENGTH column for the specified course:

UPDATE COURSE
SET STRENGTH = 180
WHERE COURSEID = 'C001';

  • UPDATE COURSE: This specifies that you're updating the COURSE table.
  • SET STRENGTH = 180: This sets the STRENGTH column to 180.
  • WHERE COURSEID = 'C001': This ensures only the course with CourseID C001 is updated.

(b) Display the details of MBA Course:

To display details of the MBA course, you'll use the SELECT statement along with the WHERE clause to filter the results:

SELECT *
FROM COURSE
WHERE COURSE_NAME = 'MBA';

  • **SELECT ***: This selects all columns in the COURSE table.
  • FROM COURSE: This specifies the table you are selecting data from.
  • WHERE COURSE_NAME = 'MBA': This filters the results to only include rows where the COURSE_NAME is MBA.

By executing these queries, you will successfully update the STRENGTH of the specified course and retrieve all details of the MBA course from the COURSE table.