Question

In: Computer Science

You have information about recent sales that you want to use for testing the database. 1....

You have information about recent sales that you want to use for testing the database. 1. Create the tables for the data provided. The tables should include the primary and foreign keys. Provide the SQL statements. 2. Insert the data into the tables. Provide the SQL statements. 3. Show the contents of each table. Provide the SQL statements.

Customer Table Customer ID, Last Name, First Name, Street Address, City, State, Zip Code, Current Balance, Credit Limit, Sales Rep. ID Sales Representatives Table Sales Rep ID, Last Name, First Name, Street Address, City, State, Zip, Region, Region Description, Total Commission, Commission Rate Orders Table Order ID, Order Date, Customer, Shipping Date, Order Lines Order ID, Part ID, Number Ordered, Quoted Price Part Table Part ID, Part Description, Units on Hand, Class, Warehouse Number, Unit Price

Please show all work

Solutions

Expert Solution

CREATE DATABASE sales;

// Coustomer Table

CREATE TABLE IF NOT EXISTS `customer_table` (
`Customer_ID` int(100) NOT NULL AUTO_INCREMENT,
`Last_Name` varchar(100) NOT NULL,
` First_Name` varchar(100) NOT NULL,
`Street_Address` varchar(100) NOT NULL,
`City` varchar(100) NOT NULL,
`State` varchar(100) NOT NULL,
`Zip_code` int(100) NOT NULL,
`Current_Balance` int(200) NOT NULL,
`Credit_Limit` int(200) NOT NULL,
`Sales_Rep_ID` varchar(1000) NOT NULL,
PRIMARY KEY (`Customer_ID`),
UNIQUE KEY `Customer_ID` (`Customer_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

// Sales Representative Data Table

CREATE TABLE IF NOT EXISTS `sales_rep_table` (
`sales_rep_id` int(100) NOT NULL AUTO_INCREMENT,
`Last_Name` varchar(100) NOT NULL,
`First_Name` varchar(100) NOT NULL,
`Street_Address` varchar(100) NOT NULL,
`City` varchar(100) NOT NULL,
`State` varchar(100) NOT NULL,
`Zip_code` int(100) NOT NULL,
`Region` varchar(100) NOT NULL,
`Region_description` varchar(200) NOT NULL,
`Total_Commission` int(100) NOT NULL,
PRIMARY KEY (`sales_rep_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

// Orders Table

CREATE TABLE IF NOT EXISTS `orders_table` (
`Order_ID` int(100) NOT NULL AUTO_INCREMENT,
`Order_Date` date NOT NULL,
`Customer` varchar(100) NOT NULL,
`Shipping_Date` date NOT NULL,
`Order_Lines_Order_ID` varchar(100) NOT NULL,
`Part_ID` varchar(100) NOT NULL,
`Number_Ordered` varchar(100) NOT NULL,
`Quoted_Price_Part_Table_Part ID` varchar(100) NOT NULL,
`Part_Description` varchar(100) NOT NULL,
`Units_on_Hand` varchar(100) NOT NULL,
`Class` varchar(100) NOT NULL,
`Warehouse_Number` varchar(100) NOT NULL,
`Unit_Price` int(100) NOT NULL,
PRIMARY KEY (`Order_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

/*//Insertion of Data into Tables*/
INSERT INTO `sales`.`customer_table` (`Customer_ID`, `Last_Name`, ` First_Name`, `Street_Address`, `City`, `State`, `Zip_code`, `Current_Balance`, `Credit_Limit`, `Sales_Rep_ID`)
VALUES ('1', 'Text', 'Text', 'Text', 'Text', 'Text', '12313', '100', '1000', 'S1');

INSERT INTO `sales`.`sales_rep_table` (`sales_rep_id`, `Last_Name`, `First_Name`, `Street_Address`, `City`, `State`, `Zip_code`, `Region`, `Region_description`, `Total_Commission`)
VALUES ('1', 'Text', 'Text', 'Text', 'Text', 'Text', '111', 'Text', 'Text', '123');

INSERT INTO `sales`.`orders_table` (`Order_ID`, `Order_Date`, `Customer`, `Shipping_Date`, `Order_Lines_Order_ID`, `Part_ID`, `Number_Ordered`, `Quoted_Price_Part_Table_Part ID`, `Part_Description`, `Units_on_Hand`, `Class`, `Warehouse_Number`, `Unit_Price`)
VALUES ('1', '2019-03-13', 'Name', '2019-03-21', 'O12', 'P12', '2', 'QPPTP12', 'Text', 'Text', 'Text', 'Number', '123');

/* SELECTION of all the items of table and display*/
/* Coustomer Table*/
SELECT *
FROM `customer_table`
ORDER BY 'Customer_ID' ;

/* Sales representatives Table*/
SELECT *
FROM `orders_table`
ORDER BY 'Order_ID' ;

/* Orders Table*/
SELECT *
FROM `sales_rep_table`
ORDER BY 'sales_rep_id' ;

**** Thank You*******


Related Solutions

1 You're entering records into a database, and you realize you don't have the information for...
1 You're entering records into a database, and you realize you don't have the information for one of the fields. What do you do? Use letters in alphabetical order to select options A In the Field Properties section, change the Required field to Blank so users can skip the field during data entry. B Unless a field's set up to require an entry, you can skip the fields for which you don't have any data. C In order for a...
For this part, assume you are entering information about transactions into their relational database. You will...
For this part, assume you are entering information about transactions into their relational database. You will be entering financial information, but you will also need to consider the other types of information Big Marker would want to know about that event. You will also utilize what you have learned to identify internal controls specific to each transaction. The transactions are as follows: a. Billed 30 communities for monthly dues of $600 (each). b. Borrowed $10,000 from First National Bank with...
You have the following information about a company. ·       Sales in 2019 were £2000 million. Sales are...
You have the following information about a company. ·       Sales in 2019 were £2000 million. Sales are expected to grow at a rate of 15% in 2020, and afterwards the growth rate will drop to 3%. ·       EBIT margin is expected to stay constant at 15%. ·       The corporate tax rate is 40%. ·       Net working capital each year is expected to stay constant at 10% of next year's sales. ·       To generate sales growth, each year t, capital expenditure net of depreciation (i.e., Capex-...
Exercise 1: Assume you have the following data about a country. Use the information and formulas...
Exercise 1: Assume you have the following data about a country. Use the information and formulas in chapter 9 and the chapter 9 study guide to fill in the table below. (Note: these are actual data, except the rate of economic growth. Rate of economic growth data are roughly US’s average from the past (3%) and China’s projected growth rate in the near future. Are these good assumptions to use?) USA China Nominal GDP 2019 (in millions of US$) 21,430,000...
You have the following information about the activities of Martin Inc. for 2014:          Sales...
You have the following information about the activities of Martin Inc. for 2014:          Sales $ 1,620,000   Factory maintenance 67,500   Indirect labour 33,500   Direct material purchases 210,000   Factory utilities 50,000   Direct materials used in production 201,000   General and administrative expenses 102,400   Beginning work-in-process inventory 28,400   Beginning finished goods inventory 63,700   Ending work-in-process inventory 32,900   Beginning direct materials inventory 17,500   Selling expenses 98,200   Direct labour 287,000   Factory insurance 46,500   Indirect materials 40,600   Depreciation,factory 60,000   Cost of goods sold 715,000    ...
How to generate database diagram for a database that stores information about the downloads that users...
How to generate database diagram for a database that stores information about the downloads that users make. Each user must have an email address, first name, and last name. Each user can have one or more downloads. Each download must have a filename and download date/time. Note: I want steps on how to generate this diagram using oracle SQL developer Each product can be related to one or more downloads. Each product must have a name.
Think about a DATABASE PROJECT (BUSINESS PROBLEM) you want to do after school show me the...
Think about a DATABASE PROJECT (BUSINESS PROBLEM) you want to do after school show me the attributes create a three table for it and explain each table and what it mean.
Assume that you have a Saudi league player database. In this database, you have a table...
Assume that you have a Saudi league player database. In this database, you have a table containing players’ attributes such as (Name, age, position, etc.) and you decided to add information about players’ agents. Would you represent the agent information as attributes in the player table or would you create an entity set for players’ agents? Justify your answer.   I need clear answer please don't copy and paste
In your own words, describe what you have learned about hypothesis testing and hypothesis testing for...
In your own words, describe what you have learned about hypothesis testing and hypothesis testing for the mean. Give one or more examples of how you could use this information to test a problem. Be specific on what the problem would be about.
Mokunt (Pty) Ltd have the following information in their books, which they want to use for...
Mokunt (Pty) Ltd have the following information in their books, which they want to use for planning purposes for 2019. Quarter 1 Quarter 2 Quarter 3 Quarter 4 Budgeted Sales in units 50000 70000 90000 120000 Desired ending inventory of finished goods 10000 14000 18000 24000 Opening inventory of finished goods 7000 10000 14000 18000 Direct labour hour used per unit 0.5 0.5 0.5 0.5 Selling Price (BWP) 10 10 10 10 Direct labour cost per hour (BWP) 3 3...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT