Question

In: Computer Science

For this assignment you have to create tables as reviewed in class Manufacturer table, Product table...

For this assignment you have to create tables as reviewed in class Manufacturer table, Product table and Stock table. The code is in Week 7 PPT lecture. You are to add update as needed to make the tables the same as below and match Product, Manufacturer and Stock as below.

For this assignment you will be working with these same tables.  

Please complete the following tasks and submit in word file or notepad.

1. First insert tuples into two of the tables and make sure the contents of the tables match below.  

Write and execute the SQL to insert three records ProductID 844, 555 and 645 to the Product table (see below)

Write and execute the SQL to insert the one record to the Stock table (see below).  

2. Write and execute the SQL select statements to do the following selections of ALL TUPLES IN A TABLE

a. Select all (attributes) tuples in Product

b. Select all (attributes) tuples in Manufacturer

c. Select all (attributes) tuples in Stock

3. Write and execute the SQL select statements to do the following selections of ONLY SOME TUPLED IN A TABLE

a. Select Manufacturer ID = 1 tuples in Product table.

b. Select ProductID of Products that have a quantity of 300.

c. Select ProductID of Products that have quantity of 300 and less.

4. Write and execute the SQL select statements that select attributes (not all) based on a condition.

a. Select ProductID for items with ManufacturerID of 4.

b. Select ProductName for items with ManufacturerID of 1.

c. Select Products with the productName 'Keyboard'

5. Write and execute the SQL select statements that SELECT with and without DISTINCT modifier

a. Select ProductName and ManufacturerID from Product

b. Select Product Name and ManufacturerID from Product with the Distinct modifier.

c. Explain the difference in the results from a and b.

Solutions

Expert Solution

Answers

1) problem

1)INSERT INTO Product (Productid,manufactureid,quantity,name) VALUES (844,112,20,'plastic');

2) INSERT INTO Product (Productid,manufactureid,quantity,name) VALUES (555,22,20,'steel');

3)INSERT INTO Product (Productid,manufactureid,quantity,name) VALUES (645,100,10,'carbon');

4)INSERT INTO stock (productid,quantity) VALUES(844,20);

2 problem

a) SELECT * FROM Product;

b) SELECT * FROM Manufacturer;

c) SELECT * FROM Stock;

3) problem

a) SELECT Productid from product WHERE manufactureid=1;

b) SELECT Productid from product WHERE quantity=300;

c) SELECT name from product WHERE quantity<=300;

4)problem

a) SELECT Productid from product WHERE manufactureid=4;

b) SELECT Productid from product WHERE manufactureid=1;

c) SELECT * from product WHERE name='keyboard';

5)problem

a) SELECT name,manufactureid from product;

b) SELECT DISTINCT name,manufacturerid from product;

c) As you can see above results, The distinct modifier will remove repeating tuples.


Related Solutions

For this assignment you have to create tables as reviewed in class Manufacturer table, Product table...
For this assignment you have to create tables as reviewed in class Manufacturer table, Product table and Stock table. The code is in Week 7 PPT lecture. You are to add update as needed to make the tables the same as below and match Product, Manufacturer and Stock as below. For this assignment you will be working with these same tables.   Please complete the following tasks and submit in word file or notepad. 1. First insert tuples into two of...
Tables: Create table Item(    &nbs... Bookmark Tables: Create table Item(                 ItemId           &nb
Tables: Create table Item(    &nbs... Bookmark Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primary key,                 Decription           varchar2(30),                 Unitcost               number(7,2)); Create table Customer(                 custID                   char(5) constraint cid.unique primary key,                 custName          varchar2(20),                 address                                varchar2(50)); Create table Orderdata( orderID                char(5) constraint oid_uniq primary key,                 orderdate           date,                 shipdate              date,                 ItemId                  char(5) references Item.ItemId,                 No_of_items     number(4),                 Unitcost               number(7,2),                 Order_total        number(7,2),                 custID                   char(5) references customer.custID); Insert Into Item values(‘A123’,’Pencil’,2.5);...
Homework Arrays and Tables In this assignment you are to create an algorithm, flowchart, and pseudocode...
Homework Arrays and Tables In this assignment you are to create an algorithm, flowchart, and pseudocode for a solution of the following problem. This solution will include the use of arrays needed to complete all parts of the logic. You have requested to develop a program that will record and process the rainfall totals of a 12 month period. You would use an array to store each months total. Once all 12 months amounts are entered then your solution need...
JAVA PROGRAMMING. In this assignment, you are to create a class named Payroll. In the class,...
JAVA PROGRAMMING. In this assignment, you are to create a class named Payroll. In the class, you are to have the following data members: name: String (5 pts) id: String   (5 pts) hours: int   (5 pts) rate: double (5 pts) private members (5 pts) You are to create no-arg and parameterized constructors and the appropriate setters(accessors) and getters (mutators). (20 pts) The class definition should also handle the following exceptions: An employee name should not be empty, otherwise an exception...
DROP DATABASE class;CREATE DATABASE class;Use class;drop table if exists Class;drop table if exists Student;CREATE TABLE Class...
DROP DATABASE class;CREATE DATABASE class;Use class;drop table if exists Class;drop table if exists Student;CREATE TABLE Class (CIN int PRIMARY KEY, FirstName varchar(255), LastName varchar(255), Gender varchar(1), EyeColor varchar(50), HairColor varchar(50), HeightInches int,CurrentGrade varchar(1));CREATE TABLE Student (SSN int PRIMARY KEY,FirstName varchar(255),LastName varchar(255), Age int,BirthMonth varchar(255),HeightInches int,Address varchar(255),City varchar(255),PhoneNumber varchar(12),Email varchar(255),FavColor varchar(255),FavNumber int);INSERT INTO Class VALUES(1, "David", "San", "M", "BRN", "BLK", 72, "-");INSERT INTO Class VALUES(2, "Jeff", "Gonzales", "M", "BRN", "BLK", 68, "B");INSERT INTO Class VALUES(3, "Anna", "Grayson", "F", "BRN", "BRN", 62,...
Ingles Corporation is a manufacturer of tables. The table tops are manufactured by Ingles, but the...
Ingles Corporation is a manufacturer of tables. The table tops are manufactured by Ingles, but the table legs are purchased from an outside supplier. The Assembly Department takes a manufactured table top and attaches the four purchased table legs. It takes 16 minutes of labor to assemble a table. The company follows a policy of producing enough tables to ensure that 40 percent of next month’s sales are in the current month’s finished goods inventory. Ingles also purchases sufficient materials...
Ingles Corporation is a manufacturer of tables. The table tops are manufactured by Ingles, but the...
Ingles Corporation is a manufacturer of tables. The table tops are manufactured by Ingles, but the table legs are purchased from an outside supplier. The Assembly Department takes a manufactured table top and attaches the four purchased table legs. It takes 16 minutes of labor to assemble a table. The company follows a policy of producing enough tables to ensure that 40 percent of next month’s sales are in the current month’s finished goods inventory. Ingles also purchases sufficient materials...
Ingles Corporation is a manufacturer of tables. The table tops are manufactured by Ingles, but the...
Ingles Corporation is a manufacturer of tables. The table tops are manufactured by Ingles, but the table legs are purchased from an outside supplier. The Assembly Department takes a manufactured table top and attaches the four purchased table legs. It takes 16 minutes of labor to assemble a table. The company follows a policy of producing enough tables to ensure that 40 percent of next month’s sales are in the current month’s finished goods inventory. Ingles also purchases sufficient materials...
Write CREATE TABLE and INSERT INTO statements in order to create and populate five tables in...
Write CREATE TABLE and INSERT INTO statements in order to create and populate five tables in Oracle’s SQL*Plus.The information you need about the database ARE IN THE CHARTS BELOW. Each worksheet includes the following information about its associated table: ➢ Column names (for example, the jr_order table contains the orderID, customerID, orderDate, orderStatus, and orderShippedDate columns); ➢ Column data types (for example, orderID is INT, orderStatus is VARCHAR2(2), etc.); ➢ Column constraints, if any (for example, orderID in the jr_order...
java For this assignment, you will create a Time class that holds an hour value and...
java For this assignment, you will create a Time class that holds an hour value and a minute value to represent a time. We will be using "military time", so 12:01 AM is 0001 and 1 PM is 1300. For this assignment, you may assume valid military times range from 0000 to 2359. Valid standard times range from 12:00 AM to 11:59 PM. In previous assignments, we had a requirement that your class be named Main. In this assignment, the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT