Question

This is my code, but when I try to create my "Qualified" Table it won't let...

This is my code, but when I try to create my "Qualified" Table it won't let me enter foreign keys and I don't know why.

CREATE TABLE STUDENT(StudentID integer,

StudentName char(25) NOT NULL,

primary key(StudentName))

CREATE TABLE FACULTY(FacultyID integer,

FacultyName char(25) NOT NULL,

primary key(FacultyID))

CREATE TABLE COURSE(CourseID integer,

CourseName char(15) NOT NULL,

primary key(CourseID))

CREATE TABLE QUALIFIED(DateQualified date,

foreign key(FacultyID) references FACULTY(FacultyID),

foreign key(CourseID) references COURSE(CourseID))

Homework Answers

Answer #1

Columns in QUALIFIED table are missing in your CREATE TABLE Statement.

Update QUALIFIED table creation as follows:

CREATE TABLE QUALIFIED(DateQualified date,
   FacultyID integer,
   CourseID integer,
   foreign key(FacultyID) references FACULTY(FacultyID),
   foreign key(CourseID) references COURSE(CourseID))

First we need to create columns in the current table and then foreign key relationship should be established with corresponding tables.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This is my code but I am having trouble with the SECTION and REGISTRATION table. The...
This is my code but I am having trouble with the SECTION and REGISTRATION table. The error for section says course id isn't a column and with registration, it says there are no foreign key but that is all that is in the registration table. CREATE TABLE STUDENT(StudentID integer, StudentName char(25) NOT NULL, primary key(StudentName)) CREATE TABLE FACULTY(FacultyID integer, FacultyName char(25) NOT NULL, primary key(FacultyID)) CREATE TABLE COURSE(CourseID integer, CourseName char(15) NOT NULL, primary key(CourseID)) CREATE TABLE QUALIFIED(DateQualified date, FacultyID...
Do a queries batch 1 (QB1): queries requiring a single table for the following project idea:...
Do a queries batch 1 (QB1): queries requiring a single table for the following project idea: Description: This is a solution that saves student records for an educational institution. I will keep their information, subjects, fees, and their academic progress. My DBMS based solution will allow the client to save a lot of time and effort. My design goal is to separate files for each student where the data will store information about the student. Schema: Student's Information Fees Subjects...
PLEASE USE MICROSOFT SQL SERVER MANAGEMENT STUDIO 18 The purpose of this task is to create...
PLEASE USE MICROSOFT SQL SERVER MANAGEMENT STUDIO 18 The purpose of this task is to create a student table such that it has 2 partitions. One that will include all student id's through 500 and a second one that will include all student id's above 500. StudentID                   int           StudentName              varchar(30) *StudentID should be a a primary key. **StudentName should be required. Do you not use the master filegroup. Each partition should be associated with a different physical file. Use any...
1) Add to a relational table DEPARTMENT information about the total number of employees in each...
1) Add to a relational table DEPARTMENT information about the total number of employees in each department. Note, that if a department has not employee then for such a department the total number of employees must be set to zero (0). The total number of employees must be a positive number no more than 999. Use SELECT statement to list the contents of an extended relational table DEPARTMENT in the descending order of the total number of employees. Finally, remove...
Space X Bank CREATE TABLE Branch(BranchIDNumber VARCHAR(15) PRIMARY KEY NOT NULL, BranchName VARCHAR(6) NOT NULL, Address...
Space X Bank CREATE TABLE Branch(BranchIDNumber VARCHAR(15) PRIMARY KEY NOT NULL, BranchName VARCHAR(6) NOT NULL, Address VARCHAR(50) NOT NULL, City TEXT NULL, State CHAR(2) NULL, ZipCode INT(11) NOT NULL, OfficeNum VARCHAR(15) NOT NULL, FaxNum VARCHAR(15) NOT NULL); CREATE TABLE Employee(EmployeeIDNumber VARCHAR(15) NOT NULL,FirstName VARCHAR(35) NOT NULL, LastName VARCHAR(35) NOT NULL, Email VARCHAR(100) NOT NULL, BranchIDNumber VARCHAR(11) NOT NULL, FOREIGN KEY(BranchIDNumber) REFERENCES Branch(BranchIDNumber), JobTitle ENUM("Manager","Staff") NOT NULL, Salary DECIMAL(8, 2) NOT NULL, HomeNumber VARCHAR(13) NULL, CellNumber VARCHAR(13) NOT NULL); CREATE TABLE...
Task 7.1.2. Create a view named nc_jobs which shows all the bookjob information for a job...
Task 7.1.2. Create a view named nc_jobs which shows all the bookjob information for a job with a jobtype of N for publisher with a creditcode of C. CREATE TABLE publishers ( cust_id       CHAR(3) NOT NULL, name        CHAR(10), city        CHAR(10), phone        CHAR(8), creditcode    CHAR(1), primary key (cust_id) ); CREATE TABLE bookjobs ( job_id       CHAR(3) NOT NULL, cust_id       CHAR(3), job_date    DATE, descr CHAR(10), jobtype CHAR(1), primary key (job_id), foreign key...
CREATE TABLE Customers (Customer# NUMBER(4), LastName VARCHAR2(10) NOT NULL, FirstName VARCHAR2(10) NOT NULL, Address VARCHAR2(20), City...
CREATE TABLE Customers (Customer# NUMBER(4), LastName VARCHAR2(10) NOT NULL, FirstName VARCHAR2(10) NOT NULL, Address VARCHAR2(20), City VARCHAR2(12), State VARCHAR2(2), Zip VARCHAR2(5), Referred NUMBER(4), Region CHAR(2), Email VARCHAR2(30), CONSTRAINT customers_customer#_pk PRIMARY KEY(customer#), CONSTRAINT customers_region_ck CHECK (region IN ('N', 'NW', 'NE', 'S', 'SE', 'SW', 'W', 'E')) ); CREATE TABLE Orders (Order# NUMBER(4), Customer# NUMBER(4), OrderDate DATE NOT NULL, ShipDate DATE, ShipStreet VARCHAR2(18), ShipCity VARCHAR2(15), ShipState VARCHAR2(2), ShipZip VARCHAR2(5), ShipCost NUMBER(4,2), CONSTRAINT orders_order#_pk PRIMARY KEY(order#), CONSTRAINT orders_customer#_fk FOREIGN KEY (customer#) REFERENCES customers(customer#)); In...
SQL Data: you can just copy paste it into mysql to. CREATE DATABASE University;USE University; CREATE...
SQL Data: you can just copy paste it into mysql to. CREATE DATABASE University;USE University; CREATE TABLE Student (  sid INT PRIMARY KEY,  name VARCHAR(20) NOT NULL,  address VARCHAR(20) NOT NULL,  major CHAR(2)); CREATE TABLE Professor (  pid INT PRIMARY KEY,  name VARCHAR(20) NOT NULL,  department VARCHAR(10) NOT NULL); CREATE TABLE Course (  cid INT PRIMARY KEY,  title VARCHAR(20) NOT NULL UNIQUE,  credits INT NOT NULL,  area VARCHAR(5) NOT NULL); CREATE TABLE Transcript (  sid INT,  cid INT,  pid INT,  semester VARCHAR(9),  year YEAR,  grade CHAR(1) NOT NULL,  PRIMARY KEY (sid, cid, semester, year),  FOREIGN KEY (sid) REFERENCES Student...
1.Consider the following (normalized) relational model (primary keys are underlined, foreign keys are in italics). EMPLOYEE(SSN,...
1.Consider the following (normalized) relational model (primary keys are underlined, foreign keys are in italics). EMPLOYEE(SSN, ENAME, EADDRESS, SEX, DATE_OF_BIRTH, SUPERVISOR, DNR) S U P E R V I S O R : foreign key refers to SSN in EMPLOYEE, NULL value allowed D N R : foreign key refers to DNR in DEPARTMENT, NULL value not allowed DEPARTMENT(DNR, DNAME, DLOCATION, MGNR) MGNR: foreign key refers to SSN in EMPLOYEE, NULL value not allowed PROJECT(PNR, PNAME, PDURATION, DNR) DNR: foreign...
-- Table construction (just 1 simplest possible way) CREATE TABLE PetType ( petTypeId VARCHAR(10) PRIMARY KEY,...
-- Table construction (just 1 simplest possible way) CREATE TABLE PetType ( petTypeId VARCHAR(10) PRIMARY KEY, animalType VARCHAR(20), breed VARCHAR(20) ); CREATE TABLE Owner ( ownerId VARCHAR(10) PRIMARY KEY, firstName VARCHAR(20), lastName VARCHAR(20) NOT NULL, homePhoneNumber VARCHAR(20), streetAddress VARCHAR(80), suburb VARCHAR(20), postcode VARCHAR(10) ); CREATE TABLE Pet ( petId VARCHAR(10) PRIMARY KEY, petName VARCHAR(20), sex CHAR(1) CHECK (sex IN ('M', 'F')), petTypeId VARCHAR(10) FOREIGN KEY REFERENCES PetType ); CREATE TABLE PetAndOwner ( ownerId VARCHAR(10), petId VARCHAR(10), PRIMARY KEY (ownerId, petId),...