Question

Create a paid invoices table that has the same structure as the invoices table, but it...

Create a paid invoices table that has the same structure as the invoices table, but it does not need any foreign key constraints (or other constraints, for that matter) since data will be transferred into the paid table in order to archive them out of the normal invoices table.

Invoices table:

create table invoices
(
invoice_id number(10),
vendor_id number(10) not null,
invoice_number varchar2(50) not null,
invoice_date date not null,
invoice_total number(9,2) not null,
payment_total number(9,2) default 0,
credit_total number(9,2) default 0,
terms_id number(10) not null,
invoice_due_date date not null,
payment_date date,
constraint invoices_pk
primary key (invoice_id),
constraint invoices_fk_vendors
foreign key (vendor_id)
references vendors (vendor_id),
constraint invoices_fk_terms
foreign key (terms_id)
references terms (terms_id)
);

Homework Answers

Answer #1

create table paidinvoice(
invoice_id number(10),
vendor_id number(10),
invoice_number varchar2(50),
invoice_date date,
invoice_total number(9,2),
payment_total number(9,2),
credit_total number(9,2),
terms_id number(10),
invoice_due_date date,
payment_date date
);

Note:
Since in the question it is given the structure of the invoice table is maintained i used all the columns of the invoice table in the paid invoice table ,but in this table we are not using any constraints.

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
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...
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))
Consider the following relational database:               STUDENT     (STDNO, SNAME, DEPTNO#)             &n
Consider the following relational database:               STUDENT     (STDNO, SNAME, DEPTNO#)               DEP                 (DEPTNO, DNAME)               COURSE        (CORSNO, CNAME, DEPTNO#, CMAX)               ENROLMENT       (STDNO#, CORSNO#, GRADE, EDATE) STUDENT.DEPTNO is the department number of the student. COURSE.DEPTNO is the department number that offers the course. ENROLMENT models the registrations of students in courses (M:M relationship) where the GRADE is the grade obtained by the student in the course. PART I : DATA DESCRIPTION LANGUAGE (DDL) Write DDL commands to create the four...
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...
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...
how would the data insert MYSQL query for below table look like: CREATE TABLE Appointments( AppointmentID...
how would the data insert MYSQL query for below table look like: CREATE TABLE Appointments( AppointmentID int NOT NULL, Date Time datetime, Details varchar(100), Remarks varchar(200), POwnerID int, TenantID int, SerAgtID int, PRIMARY KEY (AppointmentID), FOREIGN KEY (POwnerID) REFERENCES Property Owners (POwnerID), FOREIGN KEY (TenantID) REFERENCES Tenants (TenantID), FOREIGN KEY (SerAgtID) REFERENCES Service Agents (SerAgtID));
Perform SQL queries in the given data structure. write an SQL query that gives the number...
Perform SQL queries in the given data structure. write an SQL query that gives the number of courses taken for every student in the student table. For each instructor, show the instructor name and the number of sections that have been taught by that instructor. You do not need to include instructors who have never taught a section. List in order of decreasing the number of sections taught. Give the number of semester/year combinations in which sections have been offered....
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...
The queries listed below must be implemented with a set algebra operation. 1)Find the department name...
The queries listed below must be implemented with a set algebra operation. 1)Find the department name and code for all departments that only offered subjects that worth 6 credits. Note that a subject offered by a department means a lecturer of the department has been assigned to teach the subject. CREATE TABLE LPOSITION(    position       VARCHAR(20)   NOT NULL,   /* Position occupied       */    salary_level   CHAR   NOT NULL,       /* Salary level   */    CONSTRAINT LPosition_PKey PRIMARY KEY (position)...
Assignment Instructions (MY WORK IN MYSQLBENCH)- Follow instructions in class to download and build a database...
Assignment Instructions (MY WORK IN MYSQLBENCH)- Follow instructions in class to download and build a database in your DBMS. Write and demonstrate queries (in-class) that do the following: Download the appropriate attached SQL file for your DBMS. Load the file into your database design tool and run it to build the Pine Valley Furniture Company database. This is the database that is used in the textbook examples for both Chapters 5 and 6. Write a query to show the price...