Question: 1 . Use the attached DDL to create the MAJORS and STUDENTS tables and load data into the STUDENTS table. 2 . Have ChatGPT (
Use the attached DDL to create the MAJORS and STUDENTS tables and load data into the STUDENTS table.
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
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.
Use the EXPLAIN PLAN statement to generate the execution plan for your query.
Query the PLANTABLE to review the execution plan and confirm the use of a hash join.
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.
Use the EXPLAIN PLAN statement to generate the execution plan for your query.
Query the PLANTABLE 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 VARCHAR NOT NULL,
LastName VARCHAR NOT NULL,
Major VARCHAR
;
CREATE TABLE Majors
Name VARCHAR PRIMARY KEY,
Description VARCHAR
;
INSERT INTO Students StudentID FirstName, LastName, Major VALUES 'John', 'Smith', 'Computer Science';
INSERT INTO Students StudentID FirstName, LastName, Major VALUES 'Emily', 'Johnson', 'Mathematics';
INSERT INTO Students StudentID FirstName, LastName, Major VALUES 'Sarah', 'Williams', 'Biology';
INSERT INTO Students StudentID FirstName, LastName, Major VALUES 'Michael', 'Brown', 'Physics';
INSERT INTO Students StudentID FirstName, LastName, Major VALUES 'David', 'Davis', 'Chemistry';
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
