Question

Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make t...

Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ...

Make the following modifications:

  1. For the vendors table:
    1. Comment out the table-level primary key
    2. Change the VendorIDcolumn to be a column-level primary key
    3. Add a VendorEmail column to the bottom of the table definition (define the data type for the column as variable character and set it to not exceed 45 characters)
  2. After the lineItems table, add code to create a table named audit:
    1. Create the following columns in the audit table
    2. auditID (integer, nulls not accepted, and make it an auto-incrementing primary key)
    3. auditorFirstName (nulls not accepted, variable character data type with a max of 45 characters)
    4. auditorLastName (nulls not accepted, variable character data type with a max of 45 characters)
    5. auditDate (date data type)
    6. auditTime (time data type)
    7. auditExtra (integer, max display size is 8, nulls not accepted)
  3. At the bottom of the file, create an index for the vendorName column in the vendors file
  4. Use MySQL comments to add your name, date, and WEB-182 in a comment block at the top of the file
  5. Use MySQL comments to _clearly_ mark each of the modifications to the ap-mod.sql file (such as /* --- Mod #1 --- */)
  6. Save your new ap-mod.sql file.

BELOW IS THE FILE THAT WE ARE MODIFYING .....

ap-mod.sql-

DROP DATABASE IF EXISTS ap;
CREATE DATABASE ap;
USE ap;

CREATE TABLE IF NOT EXISTS vendors (
vendorID INT NOT NULL AUTO_INCREMENT,
vendorName VARCHAR(45) NOT NULL UNIQUE,
vendorAddress VARCHAR(45) NOT NULL,
vendorCity VARCHAR(45) NOT NULL,
vendorState VARCHAR(45) NOT NULL,
vendorZipCode VARCHAR(10) NOT NULL,
vendorPhone VARCHAR(20) NOT NULL,
PRIMARY KEY (vendorID)
);

CREATE TABLE IF NOT EXISTS invoices (
invoiceID INT NOT NULL AUTO_INCREMENT,
vendorID INT NOT NULL,
invoiceNumber VARCHAR(45) NOT NULL,
invoiceDate DATETIME NOT NULL,
invoiceTotal DECIMAL NOT NULL,
paymentTotal DECIMAL,
PRIMARY KEY (invoiceID),
CONSTRAINT invoicesFkVendors
FOREIGN KEY (vendorID) REFERENCES vendors (vendorID)
);

CREATE TABLE IF NOT EXISTS lineItems (
lineItemID INT NOT NULL AUTO_INCREMENT,
invoiceID INT NOT NULL,
description VARCHAR(45) NOT NULL,
quantity INT NOT NULL,
price INT NOT NULL,
lineItemTotal DECIMAL NOT NULL,
PRIMARY KEY (lineItemID),
CONSTRAINT lineItemsFkInvoices
FOREIGN KEY (invoiceID) REFERENCES invoices (invoiceID)
);

CREATE INDEX vendorID
ON invoices (vendorID);

CREATE INDEX invoiceNumber
ON invoices (invoiceNumber);

CREATE INDEX invoiceID
ON lineItems (invoiceID);

GRANT SELECT, INSERT, UPDATE, DELETE
ON *
TO mgs_user
IDENTIFIED BY 'pa55word';

Please Help I'm running out of time.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

Please find the code below.

ap-mod.sql-
DROP DATABASE IF EXISTS ap;
CREATE DATABASE ap;
USE ap;

CREATE TABLE IF NOT EXISTS vendors (
/* --- Mod #1 --- */
/*adding column level primary key*/
vendorID INT NOT NULL PRIMARY_KEY AUTO_INCREMENT ,
vendorName VARCHAR(45) NOT NULL UNIQUE,
vendorAddress VARCHAR(45) NOT NULL,
vendorCity VARCHAR(45) NOT NULL,
vendorState VARCHAR(45) NOT NULL,
vendorZipCode VARCHAR(10) NOT NULL,
vendorPhone VARCHAR(20) NOT NULL,
vendorEmail VARCHAR(40)
/* --- Mod #2 --- */
/*PRIMARY KEY (vendorID)*//* Tablelevel primary key is commented*/
);

CREATE TABLE IF NOT EXISTS invoices (
invoiceID INT NOT NULL AUTO_INCREMENT,
vendorID INT NOT NULL,
invoiceNumber VARCHAR(45) NOT NULL,
invoiceDate DATETIME NOT NULL,
invoiceTotal DECIMAL NOT NULL,
paymentTotal DECIMAL,
PRIMARY KEY (invoiceID),
CONSTRAINT invoicesFkVendors
FOREIGN KEY (vendorID) REFERENCES vendors (vendorID)
);

CREATE TABLE IF NOT EXISTS lineItems (
lineItemID INT NOT NULL AUTO_INCREMENT,
invoiceID INT NOT NULL,
description VARCHAR(45) NOT NULL,
quantity INT NOT NULL,
price INT NOT NULL,
lineItemTotal DECIMAL NOT NULL,
PRIMARY KEY (lineItemID),
CONSTRAINT lineItemsFkInvoices
FOREIGN KEY (invoiceID) REFERENCES invoices (invoiceID)
);

/* --- Mod #3 --- */
CREATE TABLE IF NOT EXISTS audit (
auditID INT NOT NULL AUTO_INCREMENT PRIMARY_KEY,
auditorFirstName VARCHAR(45) NOT NULL,)
auditorLastName VARCHAR(45) NOT NULL,
auditDate DATE,
auditTime TIME,
auditExtra INT(8) NOT NULL);


CREATE INDEX vendorID
ON invoices (vendorID);
CREATE INDEX invoiceNumber
ON invoices (invoiceNumber);
CREATE INDEX invoiceID
ON lineItems (invoiceID);
/* --- Mod #4 --- */
CREATE INDEX vendorName
ON vendors (vendorName);

GRANT SELECT, INSERT, UPDATE, DELETE
ON *
TO mgs_user
IDENTIFIED BY 'pa55word';ap-mod.sql-
DROP DATABASE IF EXISTS ap;
CREATE DATABASE ap;
USE ap;

CREATE TABLE IF NOT EXISTS vendors (
/* --- Mod #1 --- */
/*adding column level primary key*/
vendorID INT NOT NULL PRIMARY_KEY AUTO_INCREMENT ,
vendorName VARCHAR(45) NOT NULL UNIQUE,
vendorAddress VARCHAR(45) NOT NULL,
vendorCity VARCHAR(45) NOT NULL,
vendorState VARCHAR(45) NOT NULL,
vendorZipCode VARCHAR(10) NOT NULL,
vendorPhone VARCHAR(20) NOT NULL,
vendorEmail VARCHAR(40)
/* --- Mod #2 --- */
/*PRIMARY KEY (vendorID)*//* Tablelevel primary key is commented*/
);

CREATE TABLE IF NOT EXISTS invoices (
invoiceID INT NOT NULL AUTO_INCREMENT,
vendorID INT NOT NULL,
invoiceNumber VARCHAR(45) NOT NULL,
invoiceDate DATETIME NOT NULL,
invoiceTotal DECIMAL NOT NULL,
paymentTotal DECIMAL,
PRIMARY KEY (invoiceID),
CONSTRAINT invoicesFkVendors
FOREIGN KEY (vendorID) REFERENCES vendors (vendorID)
);

CREATE TABLE IF NOT EXISTS lineItems (
lineItemID INT NOT NULL AUTO_INCREMENT,
invoiceID INT NOT NULL,
description VARCHAR(45) NOT NULL,
quantity INT NOT NULL,
price INT NOT NULL,
lineItemTotal DECIMAL NOT NULL,
PRIMARY KEY (lineItemID),
CONSTRAINT lineItemsFkInvoices
FOREIGN KEY (invoiceID) REFERENCES invoices (invoiceID)
);

/* --- Mod #3 --- */
CREATE TABLE IF NOT EXISTS audit (
auditID INT NOT NULL AUTO_INCREMENT PRIMARY_KEY,
auditorFirstName VARCHAR(45) NOT NULL,)
auditorLastName VARCHAR(45) NOT NULL,
auditDate DATE,
auditTime TIME,
auditExtra INT(8) NOT NULL);


CREATE INDEX vendorID
ON invoices (vendorID);
CREATE INDEX invoiceNumber
ON invoices (invoiceNumber);
CREATE INDEX invoiceID
ON lineItems (invoiceID);
/* --- Mod #4 --- */
CREATE INDEX vendorName
ON vendors (vendorName);

GRANT SELECT, INSERT, UPDATE, DELETE
ON *
TO mgs_user
IDENTIFIED BY 'pa55word';

Add a comment
Know the answer?
Add Answer to:
Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make t...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a select statement that returns the vendorname and paymentsum of each vendor, where paymentsum is...

    Write a select statement that returns the vendorname and paymentsum of each vendor, where paymentsum is the sum of the paymentotal column. Return only the top ten vendors who have been paid the most and the number of invoices is >5. CREATE TABLE InvoiceArchive InvoiceID int NOT NULL, VendorID int NOT NULL InvoiceNumber varchar(50) NOT NULL, InvoiceDate smalldatetime NOT NULL, Invoice Total money NOT NULL, Payment Total money NOT NULL, CreditTotal money NOT NULL, TermsID int NOT NULL, InvoiceDueDate smalldatetime...

  • I need help with the following SQL query for a company database (script given below). The...

    I need help with the following SQL query for a company database (script given below). The name of the Department. The number of employees working in that department. The number of different projects controlled by this department. The name of the project controlled by this department that has the maximum number of employees of the company working on it. The number of the above project. The cumulative sum of the number of employees of the company working on the projects...

  • SQL problem solving help; First 3 tables are finnished; Need help understanding on how to do...

    SQL problem solving help; First 3 tables are finnished; Need help understanding on how to do steps after. First 3 tables are after the first 2 images for reference if needed. //1// CREATE TABLE kr_customer ( Name VARCHAR(40) NOT NULL PRIMARY KEY, City VARCHAR(20), Status CHAR(1) ); //2// CREATE TABLE kr_salesperson ( Name VARCHAR(40) NOT NULL PRIMARY KEY, Age INT, Salary DECIMAL(8, 2) ); //3// CREATE TABLE kr_order ( Order_Number number(3) NOT NULL PRIMARY KEY, Customer_Name VARCHAR(40), Salesperson_Name VARCHAR(40), Amount...

  • I need help in SQL management studio please. Question: Create the same query as query 5,...

    I need help in SQL management studio please. Question: Create the same query as query 5, but only include artists if they have 'Pop' Genre. Previous question: Create a list of all composers and artists in your database. Include two columns in your record set (the names of the returned columns are in brackets): 'Composer/Artist Name' and 'Type' (which will indicate whether your results are from the composer or artist table). Order by 'Composer/Artist Name'. This is the answer for...

  • I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I...

    I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I just have to explain a lot so you understand how the program should work. In C programming, write a simple program to take a text file as input and encrypt/decrypt it by reading the text bit by bit, and swap the bits if it is specified by the first line of the text file to do so (will explain below, and please let me...

  • Hello! I'm posting this program that is partially completed if someone can help me out, I...

    Hello! I'm posting this program that is partially completed if someone can help me out, I will give you a good rating! Thanks, // You are given a partially completed program that creates a list of employees, like employees' record. // Each record has this information: employee's name, supervisors's name, department of the employee, room number. // The struct 'employeeRecord' holds information of one employee. Department is enum type. // An array of structs called 'list' is made to hold...

  • 0. Modify or create the table(file) named Staff first used in assignment 5. There is no...

    0. Modify or create the table(file) named Staff first used in assignment 5. There is no change to the structure, and if you need to recreate it the column names, data types and lengths are described below: Table Name Column Name Data Type Length Comment/constraint Staff: id int name varchar office char fee decimal reviewDate date 3 primary key 15 not null 7 7,2 default 0.00 Initials have been added to the name column values, so data for an insert...

  • A guide to SQL 9th edition Colonial Adventure Tours chapter 3 page 90-92 Odd numbered exercises...

    A guide to SQL 9th edition Colonial Adventure Tours chapter 3 page 90-92 Odd numbered exercises only figure 3-39(Guide, trip, customer, reservation and Trip_Guides) figure 1-5 chapter 1: 7. Review me on TUI UTILIVUDIJ types used to create the ITEM table in Figure 3-34. Suggest alternate data types for the DESCRIPTION, ON HAND. and STOREHOUSE fields and explain your recommendation Colonial Adventure Tours Use SQL to complete the following exercises 1. Create a table named ADVENTURE TRIP. The table has...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

  • MYSQL Questions: 1.For every author, display the number of books written by that author that is...

    MYSQL Questions: 1.For every author, display the number of books written by that author that is carried by Henry Books. Display the author number as ‘Author Number’, author name concatenated (first last) as ‘Author Name’, and the total number of books written by the author as ‘Number of Titles by Author’. List in descending order by author number. Limit the output to 10 rows. Insert your snip of the query and resultset together here. 2.Using a function, what are the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT