Knowee
Questions
Features
Study Tools

Write a query to display the coursename, coursecategory, coursefees and courseduration of the courses whose batch strength is greater than or equal to 10 and month of batch start date is 'February'. Display the records sorted in ascending order based on coursename.Note:1. Display only the coursename, coursecategory, coursefees and courseduration of the courses whose batch strength is greater than or equal to 10 and month of batch start date is 'February'2. Tables involved are course and batch3. Order by is mandatory.Sample Output :

Question

Write a query to display the coursename, coursecategory, coursefees and courseduration of the courses whose batch strength is greater than or equal to 10 and month of batch start date is 'February'. Display the records sorted in ascending order based on coursename.Note:1. Display only the coursename, coursecategory, coursefees and courseduration of the courses whose batch strength is greater than or equal to 10 and month of batch start date is 'February'2. Tables involved are course and batch3. Order by is mandatory.Sample Output :

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here is the SQL query you asked for:

SELECT c.coursename, c.coursecategory, c.coursefees, c.courseduration
FROM course c
JOIN batch b ON c.courseid = b.courseid
WHERE b.batchstrength >= 10 AND MONTH(b.batchstartdate) = 2
ORDER BY c.coursename ASC;

Here is the step by step explanation:

  1. SELECT c.coursename, c.coursecategory, c.coursefees, c.courseduration: This line is selecting the columns we want to display in our result. We are selecting the course name, course category, course fees, and course duration from the course table.

  2. FROM course c: This line is specifying the table we are selecting the data from. We are selecting from the course table and giving it an alias of 'c' for simplicity.

  3. JOIN batch b ON c.courseid = b.courseid: This line is joining the course table with the batch table where the course id in both tables are the same. We are giving the batch table an alias of 'b' for simplicity.

  4. WHERE b.batchstrength >= 10 AND MONTH(b.batchstartdate) = 2: This line is the condition for the data to be selected. We are only selecting the data where the batch strength is greater than or equal to 10 and the month of the batch start date is February (month number 2).

  5. ORDER BY c.coursename ASC: This line is ordering the result in ascending order based on the course name.

This problem has been solved

Similar Questions

Write a query to display the coursename of the courses whose month of batch start date is between 'February' and 'July'. Display the records sorted in ascending order based on coursename.

Write a query to display the coursename of the courses having the coursefees above average fees of all the courses. Display the records sorted in ascending order based on coursename.Note:1. Display only the coursename of the courses having the coursefees above average fees of all the courses.2. Order by is mandatory.Sample Output:

Write a query to display the book_code, book_title of the books which are issued on the date "01-04-2012". Display the records sorted in ascending order based on book_code.Note:1. Display only the book_code, book_title of the books which are issued on the date "01-04-2012" from lms_book_issue and lms_book_details table.2. Use Joins. Tables involved are lms_book_issue and lms_book_details.3. Order by is mandatory.Sample Output:

Write a query to display the member_id, member_name, date_register, membership_status of the members who registered before "March 2012" and membership status is "Temporary". Display the records sorted in ascending order based on member_id.Note:1. Display the member_id, member_name, date_register, membership_status from lms_members table whose date_register is before March 2012 and membership_status as ‘Temporary’.2. Order by is mandatory.Sample Output:

Write a query to display the student qualification(squal) and the total number of students based on their qualifications. Give an alias name as ‘totalStud’. Display only the squal having the totalStud count less than 8. Display the records sorted in ascending order based on squal.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.