In SQL, specifically running on Oracle, write the following query: \"How many st
ID: 3887197 • Letter: I
Question
In SQL, specifically running on Oracle, write the following query: "How many students have more than one major?"
Note: This must be done with a nested query. Creation of temporary tables to solve the problem is not permitted. It must be completed in a single query statment. You may not create any tables nor can you alter the structure of the database. DO NOT insert any tables or modify any tables. The solution must be one statement. The only thing you can do is to create a single SQL query statement that uses the existing structure defined in the schema.
Based on the information provided, the correct output for the query should be 2.
Database Schema
Pertinent Table Information
COURSE TABLE
MAJOR TABLE
STUDENT TABLE
ENROLL TABLE
dept(dname, numphds) course(cno, cname, dname) prof (pname, dname) section(cno, dname, sectno, pname) student(sid, sname, sex, age, gpa) major(sid, dname) enroll(sid, cno, dname, sectno, grade)Explanation / Answer
select count(e1. sid) from enroll e1, enroll e2
where e1. sid = e2.sid and e1.dname != e2.dname
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.