Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, Expert response only. Below is the SQL query for Oracle...this is to create

ID: 3707355 • Letter: H

Question

Hi,

Expert response only.

Below is the SQL query for Oracle...this is to create a table for data files... in oracle. Please provide step by step for each to be able to run in Oracle DBMS.

How do I create the table in oracle and create a script? and then create query?

I need you to help me resolve the errors below for the statements that cannot run in Oracle. Error message provided and line that's throwing errors are in bold.

Error: ORA-00942: table or view does not exist

Create table scripts for the data design:

create table for Employee - primary key is SSN, foreign key is DNO

create table EMPLOYEE (FNAME varchar(255), MNIT varchar(2),

LNAME varchar(255), SSN int NOT NULL PRIMARY KEY, BDATE date,

ADDRESS varchar(255), SEX varchar(2),

SALARY int, SUPERSSN int,

DNO int ,

CONSTRAINT FK_EMPLOYEE FOREIGN KEY (DNO)

REFERENCES DEPARTMENT(DNUMBER)

);

Error: ORA-00942: table or view does not exist

create table for WORKS_ON - primary key is ESSN,PNO foreign key are ESSN,PNO

create table WORKS_ON(

ESSN int,

PNO int,

HOURS int,

CONSTRAINT WORKS PRIMARY KEY (ESSN,PNO),

CONSTRAINT FK_WORKS FOREIGN KEY (ESSN)

REFERENCES EMPLOYEE(SSN),

CONSTRAINT FK_WORKSON FOREIGN KEY (PNO)

REFERENCES PROJECT(PNUMBER)

);

Error: ORA-00942: table or view does not exist

create table for PROJECT - primary key is PNUMBER foreign key is DNUM

create table PROJECT(

PNAME varchar(255),

PNUMBER int NOT NULL PRIMARY KEY,

PLOCATION varchar(255),

DNUM int,

CONSTRAINT FK_PROJECT FOREIGN KEY (DNUM)

REFERENCES DEPARTMENT(DNUMBER)

);

Explanation / Answer

1. In first SQL, EMPLOYEE table is referencing for KEY on DEPARTMENT table which doesn't exist in Database. Therefore, generating error.

Solution: Create DEPARTMENT ?table first, then run this query.

2. In Second SQL, WORKS_ON table is referencing for KEY on PROJECT table which doesn't exist in Database.

Therefore, generating error.

Solution: Create PROJECT ?table first, then run this query.

3. In Third SQL, PROJECT table is referencing for KEY on DEPARTMENT table which doesn't exist in Database.

Therefore, generating error.

Solution: Create DEPARTMENT ?table first, then run this query.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote