Advertisements
Advertisements
Question
An educational institution is maintaining a database for storing the details of courses being offered. The database includes a table COURSE with the following attributes:
C_ID: Stores the unique ID for each course.
C_NAME: Stores the course’s name.
INSTRUCTOR: Stores the name of the course instructor.
DURATION: Stores the duration of the course in hours.
Table: COURSE
C_ID |
C_NAME |
INSTRUCTION |
DURATION |
| C101 | Data Structures | Dr. Alok | 40 |
| C102 | Machine Learning | Prof. Sunita | 60 |
| C103 | Web Development | Ms. Sakshi | 45 |
| C104 | Database Management | Mr. Suresh | 50 |
| C105 | Python Programming | Dr. Pawan | 35 |
Write SQL queries for the following:
- To add a new record with following specifications:
C_ID:C106C_NAME:Introduction to AIINSTRUCTOR:Ms. PreetiDURATION:55 - To display the longest duration among all courses.
- To count total number of courses run by the institution.
- To display the instructors’ name in lower case.
Code Writing
Advertisements
Solution
INSERT INTO COURSE (C _ ID, C _ NAME, INSTRUCTOR, DURATION) VALUES ('C106',‘INTRODUCTION TO AI’, ‘MS. PREETI’, 55);SELECT MAX (DURATION) FROM COURSE;SELECT COUNT (*) FROM COURSE;SELECT LOWER (INSTRUCTOR) FROM COURSE;
shaalaa.com
Is there an error in this question or solution?
