Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Database SQL Please do not submit previous Chegg answers Tables: Drop table category cascade constraints; Drop table trainer cascade constraints; Drop table course cascade constraints;

Database SQL

Please do not submit previous Chegg answers

Tables:

Drop table category cascade constraints; Drop table trainer cascade constraints; Drop table course cascade constraints; ------------------------------------------------------------------------------------------------------------------------------ CREATE TABLE category(cat_id NUMBER(2) PRIMARY KEY,cat_name VARCHAR2(40)); ------------------------------------------------------------------------------------------------------------------------------ CREATE TABLE trainer(train_id NUMBER(2) PRIMARY KEY,train_name VARCHAR2(20), net_worth NUMBER(4), cat_id NUMBER(2) REFERENCES category(cat_id)); ------------------------------------------------------------------------------------------------------------------------------ CREATE TABLE course(course_id NUMBER(4) PRIMARY KEY,course_name VARCHAR2(40),platform VARCHAR2(10), price NUMBER(2),train_id NUMBER(2) REFERENCES trainer(train_id), cat_id NUMBER(2) REFERENCES category(cat_id)); ------------------------------------------------------------------------------------------------------------------------------ insert into category values(1,'Project Management'); insert into category values(2,'Programming'); insert into category values(3,'Foreign Languages'); insert into category values(4,'Accounting'); ------------------------------------------------------------------------------------------------------------------------------ insert into trainer values(1,'James M.',45,1); insert into trainer values(2,'Markos',30,2); insert into trainer values(3,'Valve',2000,2); insert into trainer values(4,'Rockstar',3000,4); insert into trainer values(5,'Silver Stone',40,1); ------------------------------------------------------------------------------------------------------------------------------ insert into course values(1,'Quality Management','Zoom',40,1,1); insert into course values(2,'Risk Management','all',40,1,1); insert into course values(3,'Project Scheduling','all',45,1,1); insert into course values(4,'C++','all',39,2,2); insert into course values(5,'Java','all',20,2,2); insert into course values(6,'Php','Teams',10,3,2); insert into course values(7,'C#','Zoom',15,3,2); insert into course values(8,'Python','Teams',10,3,2); insert into course values(9,'CPA','all',50,4,4); insert into course values(10,'HR management','Teams',59,4,1); insert into course values(11,'German Language','Zoom',0,3,3); commit;

------------------------------------------------------------------------------------------

The tables are category, trainer, course

1. Display all of the courses that are cheaper than the course 'C++' and are the same category as the course 'Python'?

2. Display the name of all trainers that are worth more than the average net worth of trainers who teach Programming courses.

3. Display all the courses which belong to a category that has 3 or more courses.

4. Display the name of the trainer who has the most expensive course.

5. Display the number of courses per category and the category name.

6. Display the name of the trainer who teaches the most number of courses

7. Display the name of courses that can be given on any platform and their price is greater than the cheapest course.

8. Display the name of all courses whose trainers name length is more than 6 characters.

9. Display the average price of courses per trainer along with the trainer name.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

State the closed World Assumption.

Answered: 1 week ago

Question

4. Describe the role of narratives in constructing history.

Answered: 1 week ago

Question

1. Identify six different types of history.

Answered: 1 week ago