The common requirements of all questions are the same. Read each question carefully and submit a query to fulfill for each question. Also, students need to submit the result of the corresponding query under the query. Also, assignment has to be written with Microsoft Word for feedback. For technical issue, other formats, such as image, sql, are not appropriate to receive feedback and comments. Don’t delete or change questions. For assignment 5 and 6, you don’t need to submit screenshots. HOWEVER, YOUR SQLS MUST BE SUBMITTED, AND THE SQLS MUST BE EXECUTED CORRECTLY AND APPLIED TO THE DATABASE. I will check that your SQLs have been applied to your Database and will give a full score only if I can find outputs in your Database as SQLs are submitted.
campuses (campus_id, campus_name, street, city, state, zip, phone, campus_discount)
positions (position_id, position, yearly_membership_fee)
members (member_id, last_name, first_name, campus_address, campus_phone, campus_id, position_id, contract_duration)
fk campus_id --> campus(campus_id)
position_id --> positions(position_id)
prices (food_item_type_id, meal_type, meal_price)
food_items (food_item_id, food_item_name, food_item_type_id)
fk food_item_type_id --> prices(food_item_type_id)
food_orders (order_id, member_id, order_date)
fk member_id --> members(member_id)
food_order_lines (order_id, food_items_id, quantity)
fk order_id --> food_orders(order_id)
food_items_id --> fooditems(fooditem_id)
SQL Statements |
DATA TO BE INSERTED:
Campus:
1,'IUPUI','425 University Blvd.','Indianapolis', 'IN','46202',
'317-274-4591',.08
2,'Indiana University','107 S. Indiana Ave.','Bloomington',
'IN','47405', '812-855-4848',.07
3,'Purdue University','475 Stadium Mall Drive','West Lafayette',
'IN','47907', '765-494-1776',.06
Position:
1,'Lecturer', 1050.50
2,'Associate Professor', 900.50
3,'Assistant Professor', 875.50
4,'Professor', 700.75
5,'Full Professor', 500.50
Members:
1,'Ellen','Monk','009 Purnell', '812-123-1234', 2, 5, 12
2,'Joe','Brady','008 Statford Hall', '765-234-2345', 3, 2, 10
3,'Dave','Davidson','007 Purnell', '812-345-3456', 2, 3, 10
4,'Sebastian','Cole','210 Rutherford Hall', '765-234-2345', 3, 5,
10
5,'Michael','Doo','66C Peobody', '812-548-8956', 2, 1, 10
6,'Jerome','Clark','SL 220', '317-274-9766', 1, 1, 12
7,'Bob','House','ET 329', '317-278-9098', 1, 4, 10
8,'Bridget','Stanley','SI 234', '317-274-5678', 1, 1, 12
9,'Bradley','Wilson','334 Statford Hall', '765-258-2567', 3, 2,
10
Prices
1,'Beer/Wine', 5.50
2,'Dessert', 2.75
3,'Dinner', 15.50
4,'Soft Drink', 2.50
5,'Lunch', 7.25
Food_Items:
10001,'Lager', 1
10002,'Red Wine', 1
10003,'White Wine', 1
10004,'Coke', 4
10005,'Coffee', 4
10006,'Chicken a la King', 3
10007,'Rib Steak', 3
10008,'Fish and Chips', 3
10009,'Veggie Delight', 3
10010,'Chocolate Mousse', 2
10011,'Carrot Cake', 2
10012,'Fruit Cup', 2
10013,'Fish and Chips', 5
10014,'Angus Beef Burger', 5
10015,'Cobb Salad', 5
Food_Orders:
1, 9, 'March 5, 2005'
2, 8, 'March 5, 2005'
3, 7, 'March 5, 2005'
4, 6, 'March 7, 2005'
5, 5, 'March 7, 2005'
6, 4, 'March 10, 2005'
7, 3, 'March 11, 2005'
8, 2, 'March 12, 2005'
9, 1, 'March 13, 2005'
Order_Line:
1,10001,1
1,10006,1
1,10012,1
2,10004,2
2,10013,1
2,10014,1
3,10005,1
3,10011,1
4,10005,2
4,10004,2
4,10006,1
4,10007,1
4,10010,2
5,10003,1
6,10002,2
7,10005,2
8,10005,1
8,10011,1
9,10001,1
SQL Statements |
1 ) CREATE TABLE campuses ( campus_id Varchar2(5) NOT NULL, campus_name Varchar2(100), street Varchar2(50), city Varchar2(100), state Varchar2(50) , zip Varchar2(50) , phone Varchar2(12), campus_discount decimal (2,2));
ALTER TABLE campuses ADD CONSTRAINT campuses_campus_id_pk PRIMARY KEY (campus_id);
2) CREATE TABLE positions (position_id Varchar2(5), position Varchar2(100), yearly_membership_fee decimal (7,2));
ALTER TABLE positions ADD CONSTRAINT position_position_id_pk PRIMARY KEY (position_id);
3) CREATE TABLE members ( member_id Varchar2(5), last_name Varchar2(100), first_name Varchar2(100), campus_address Varchar2(200), campus_phone Varchar2(12), campus_id Varchar2(5), position_id Varchar2(5) ,contract_duration integer );
ALTER TABLE members ADD CONSTRAINT members_member_id_pk PRIMARY KEY (member_id);
ALTER TABLE members ADD CONSTRAINT members_campus_id_fk FOREIGN KEY (campus_id) REFERENCES campuses;
ALTER TABLE members ADD CONSTRAINT members_position_id_fk FOREIGN KEY (position_id) REFERENCES positions;
4) CREATE TABLE prices ( food_item_type_id Varchar2(5) , meal_type Varchar2(100),meal_price decimal(7,2));
ALTER TABLE prices ADD CONSTRAINT prices_food_item_type_id_pk PRIMARY KEY (food_item_type_id);
CREATE SEQUENCE prices_food_item_type_id_SEQ START WITH 1 INCREMENT BY 1 ;
5) CREATE TABLE food_items ( food_item_id Varchar2(5), food_item_name Varchar2(100), food_item_type_id Varchar2(5));
ALTER TABLE food_items ADD CONSTRAINT food_items_food_item_id_pk PRIMARY KEY (food_item_id);
ALTER TABLE food_items ADD CONSTRAINT food_items_food_item_id_fk FOREIGN KEY (food_item_type_id) REFERENCES prices;
6) CREATE TABLE food_orders (order_id Varchar2(5), member_id Varchar2(5),order_date Varchar2(25));
ALTER TABLE food_orders ADD CONSTRAINT orders_order_id_pk PRIMARY KEY (order_id);
ALTER TABLE food_orders ADD CONSTRAINT food_orders_member_id_fk FOREIGN KEY (member_id) REFERENCES members;
7) CREATE TABLE food_order_lines(order_id Varchar2(5),food_items_id Varchar2(5),quantity INTEGER);
ALTER TABLE food_order_lines ADD CONSTRAINT food_order_lines_order_food_id_pk PRIMARY KEY (order_id, food_items_id);
ALTER TABLE food_order_lines ADD CONSTRAINT food_orders_order_id_fk FOREIGN KEY (order_id) REFERENCES food_orders;
ALTER TABLE food_order_lines ADD CONSTRAINT food_orders_food_items_id_fk FOREIGN KEY (food_items_id)
REFERENCES food_items(food_item_id);
PART 2 -> INSERTING DATA
CAMPUS
INSERT INTO campuses VALUES ('1', 'IUPUI', '425 University Blvd.','Indianapolis', 'IN', '46202', '317-274-4591',.08 );
INSERT INTO campuses VALUES ('2', 'Indiana University', '107 S. Indiana Ave.','Bloomington', 'IN', '47405', '812-855-4848',.07 );
INSERT INTO campuses VALUES ('3', 'Purdue University', '475 Stadium Mall Drive','West Lafayette', 'IN', '47907', '765-494-1776',.06 );
Position
INSERT INTO positions VALUES ('1', 'Lecturer', 1050.50);
INSERT INTO positions VALUES ('2', 'Associate Professor', 900.50);
INSERT INTO positions VALUES ('3', 'Assistant Professor', 875.50);
INSERT INTO positions VALUES ('4', 'Professor', 700.75);
INSERT INTO positions VALUES ('5', 'Full Professor', 500.50);
Members
INSERT INTO members VALUES ('1', 'Ellen', 'Monk', '009 Purnell', '812-123-1234', '2', '5', 12);
INSERT INTO members VALUES ('2', 'Joe', 'Brady', '008 Statford Hall', '765-234-2345', '3', '2', 10);
INSERT INTO members VALUES ('3', 'Dave', 'Davidson', '007 Purnell', '812-345-3456', '2', '3', 10);
INSERT INTO members VALUES ('4', 'Sebastian', 'Cole', '210 Rutherford Hall', '765-234-2345', '3', '5', 10);
INSERT INTO members VALUES ('5', 'Michael', 'Doo', '66C Peobody', '812-548-8956', '2', '1', 10);
INSERT INTO members VALUES ('6', 'Jerome', 'Clark', 'SL 220', '317-274-9766', '1', '1', 12);
INSERT INTO members VALUES ('7', 'Bob', 'House', 'ET 329', '317-278-9098', '1', '4', 10);
INSERT INTO members VALUES ('8', 'Bridget', 'Stanley', 'SI 234', '317-274-5678', '1', '1', 12);
INSERT INTO members VALUES ('9', 'Bradley', 'Wilson', '334 Statford Hall', '765-258-2567', '3', '2', 10);
PRICES
INSERT INTO prices VALUES (prices_food_item_type_id_SEQ.NEXTVAL, 'Beer/Wine', 5.50);
INSERT INTO Prices VALUES (prices_food_item_type_id_SEQ.NEXTVAL, 'Dessert', 2.75);
INSERT INTO Prices VALUES (prices_food_item_type_id_SEQ.NEXTVAL, 'Dinner', 15.50);
INSERT INTO Prices VALUES (prices_food_item_type_id_SEQ.NEXTVAL, 'Soft Drink', 2.50);
INSERT INTO Prices VALUES (prices_food_item_type_id_SEQ.NEXTVAL, 'Lunch', 7.25);
FOOD_ITEMS
INSERT INTO food_items VALUES ('10001', 'Lager', '1');
INSERT INTO food_items VALUES ('10002', 'Red Wine', '1');
INSERT INTO food_items VALUES ('10003', 'White Wine', '1');
INSERT INTO food_items VALUES ('10004', 'Coke', '4');
INSERT INTO food_items VALUES ('10005', 'Coffee', '4');
INSERT INTO food_items VALUES ('10006', 'Chicken a la King', '3');
INSERT INTO food_items VALUES ('10007', 'Rib Steak', '3');
INSERT INTO food_items VALUES ('10008', 'Fish and Chips', '3');
INSERT INTO food_items VALUES ('10009', 'Veggie Delight', '3');
INSERT INTO food_items VALUES ('10010', 'Chocolate Mousse', '2');
INSERT INTO food_items VALUES ('10011', 'Carrot Cake', '2');
INSERT INTO food_items VALUES ('10012', 'Fruit Cup', '2');
INSERT INTO food_items VALUES ('10013', 'Fish and Chips', '5');
INSERT INTO food_items VALUES ('10014', 'Angus and Chips', '5');
INSERT INTO food_items VALUES ('10015', 'Cobb Salad', '5');
FOOD_ORDERS
INSERT INTO food_orders VALUES ( '1', '9', 'March 5, 2005' );
INSERT INTO food_orders VALUES ( '2', '8', 'March 5, 2005' );
INSERT INTO food_orders VALUES ( '3', '7', 'March 5, 2005' );
INSERT INTO food_orders VALUES ( '4', '6', 'March 7, 2005' );
INSERT INTO food_orders VALUES ( '5', '5', 'March 7, 2005' );
INSERT INTO food_orders VALUES ( '6', '4', 'March 10, 2005' );
INSERT INTO food_orders VALUES ( '7', '3', 'March 11, 2005' );
INSERT INTO food_orders VALUES ( '8', '2', 'March 12, 2005' );
INSERT INTO food_orders VALUES ( '9', '1', 'March 13, 2005' );
ORDER_LINE
INSERT INTO food_order_lines VALUES ( '1', '10001', 1 );
INSERT INTO food_order_lines VALUES ( '1', '10006', 1 );
INSERT INTO food_order_lines VALUES ( '1', '10012', 1 );
INSERT INTO food_order_lines VALUES ( '2', '10004', 2 );
INSERT INTO food_order_lines VALUES ( '2', '10013', 1 );
INSERT INTO food_order_lines VALUES ( '2', '10014', 1 );
INSERT INTO food_order_lines VALUES ( '3', '10005', 1 );
INSERT INTO food_order_lines VALUES ( '3', '10011', 1 );
INSERT INTO food_order_lines VALUES ( '4', '10005', 2 );
INSERT INTO food_order_lines VALUES ( '4', '10004', 2 );
INSERT INTO food_order_lines VALUES ( '4', '10006', 1 );
INSERT INTO food_order_lines VALUES ( '4', '10007', 1 );
INSERT INTO food_order_lines VALUES ( '4', '10010', 2 );
INSERT INTO food_order_lines VALUES ( '5', '10003', 1 );
INSERT INTO food_order_lines VALUES ( '6', '10002', 2 );
INSERT INTO food_order_lines VALUES ( '7', '10005', 2 );
INSERT INTO food_order_lines VALUES ( '8', '10005', 1 );
INSERT INTO food_order_lines VALUES ( '8', '10011', 1 );
INSERT INTO food_order_lines VALUES ( '9', '10001', 1 );
The common requirements of all questions are the same. Read each question carefully and submit a...
Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...
Instructions Try to answer all the questions using what you have learned in class. Please make your query general not data related This schema is used for inventory management for an OEM Part Inventory p_id Name Cost Supplier Location 1 Traction motor 200 Melco Japan 2 Alternator 400 kato USA 3 HVAC 300 Melco Japan p_id Warehouse_id quantity 1 A1 100 2 A2 250 3 B1 300 Customer Model c_id Name Location CN Canada National Canada UP Union Pacific USA...
Problems and Exercises 1 through 5 are based on the class schedule 3NF relations along with some sample data in Figure 7-16. For Problems and Exercises 1 through 5, draw a Venn or ER diagram and mark it to show the data you expect your query to use to produce the results.Figure 7-16: Class scheduling relations (for Problems and Exercises 1-5Figure 7-17 Adult literacy program (for Problems and Exercises 6-14)1. Write SQL retrieval commands for each of the following queries:a....
Using the Premier Products database answer the following questions 1. Using a union, display all customers that have rep number 65 or live in the town of Sheldon. Display all customer information. Insert your snip of the query and resultset together here: 2. Using a subquery, list the rep information for all customers who have the same credit limit as customer number 725. To receive credit for this question, do not explicitly query for rep number 35. Let MySQL do...
Topic: Inventory Manangement Part A. Database Creation Your database should have a minimum of 4 tables and include both one-to-many and many-to-many relationships. Be sure to include some numeric and/or date fields. Define all appropriate constraints, using the proper naming conventions (see Structure Notes below). Populate your database with at least 30 records in the main table(s), and whatever is needed in related tables. Submit the following: • a short description of the purpose of the database and what the...
This is questions of Accounting Information Systems 1) Fo a database. Each row in this spreadsheet represents a: ur Tet Industries tracks customer information using various Microsoft Excel spreadsheets stored in a. Field b. Record c. File d. Database 2) A d tables is a. What is the correct term for the database field in Table 1? latabase field in Table 1 that serves as a unique identifier in Table 2 and is used to link both of the a....
Problem 1-5 using the table below in the picture to be answered in Microsoft SQL. Thanks 4. Write SQL queries to answer the following questions, a. How many students were enrolled in secoon 14 b. How many students were enrolled in ISM 3113 5. Write an SOL query to answer the following question Which students were not enrolled in any courses on Problems and Exercises 6 through 14 are based on Figure 7-15. The problem set continues from Chapter 6,...
Put all of your SQL code in a file named grades.sql and submit it below. Download the starter code, which contains import_grades.sql and the grades.csv file. Using he import_grades, sql file, create your database and table. - 0 eded. 1 T Une Modify the LOAD DATA INFILE to correct the path to load the grades.csv file, and add/remove LOCAL he only modification you may make to the import_grades.sql or the grades.csv files. The data represents grades for assignments in a...
If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top of each page. Also, using a 12-point font, include the SQL statement and then provide a screen shot of each query. The screen shots must include both the SQL statement and the results for each item below based on the data entered in...
1. Define and provide examples of the following terms. Use 3-5 sentences for each term. (30 points) a. Health Informatics b. Data Quality Management c. Interoperability d. Data Lake e. Data f. Information g. Standardized h. Unstandardized i. Data Standard j. Health Information Exchange (HIE) k. Relational Database l. Primary Key m. Foreign Key n. Structured query language (SQL) o. Information Governance 2. Differentiate the difference between information governance and data governance. Provide examples of how you would implement both...