Question: 1 . Use the attached DDL to create the MAJORS and STUDENTS tables and load data into the STUDENTS table. 2 . Have ChatGPT (

1.Use the attached DDL to create the MAJORS and STUDENTS tables and load data into the STUDENTS table.
2.Have ChatGPT (or your chosen LLM) create all needed INSERT statements to load the MAJORS table with appropriate data for each major in the STUDENTS table. Use the created INSERT statements to load the MAJORS table. If there are errors (or the INSERTS will not run), ChatGPT (or your chosen LLM) make the needed changes to the INSERT statements
3.Write a query that retrieves data from both tables showing all students' FirstName, LastName, Major, and the Major's Description using an optimizer hint to enforce a hash join.
4.Use the EXPLAIN PLAN statement to generate the execution plan for your query.
5.Query the PLAN_TABLE to review the execution plan and confirm the use of a hash join.
6.Write a query that retrieves data from both tables showing all students' FirstName, LastName, Major, and the Major's Description using an optimizer hint to enforce a nested loop join.
7. Use the EXPLAIN PLAN statement to generate the execution plan for your query.
8. Query the PLAN_TABLE to review the execution plan and confirm the use of a nested loop join.
DDL:
DROP TABLE Students;
DROP TABLE Majors;
CREATE TABLE Students (
StudentID integer PRIMARY KEY,
FirstName VARCHAR2(30) NOT NULL,
LastName VARCHAR2(30) NOT NULL,
Major VARCHAR2(30)
);
CREATE TABLE Majors (
Name VARCHAR2(30) PRIMARY KEY,
Description VARCHAR2(200)
);
INSERT INTO Students (StudentID, FirstName, LastName, Major) VALUES (1, 'John', 'Smith', 'Computer Science');
INSERT INTO Students (StudentID, FirstName, LastName, Major) VALUES (2, 'Emily', 'Johnson', 'Mathematics');
INSERT INTO Students (StudentID, FirstName, LastName, Major) VALUES (3, 'Sarah', 'Williams', 'Biology');
INSERT INTO Students (StudentID, FirstName, LastName, Major) VALUES (4, 'Michael', 'Brown', 'Physics');
INSERT INTO Students (StudentID, FirstName, LastName, Major) VALUES (5, 'David', 'Davis', 'Chemistry');

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!