Question

Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primar

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);

Insert Into Item values(‘B123’,’Pen’,15);

Insert Into Customer(‘C123’,’ABC Gen stores’,’Sanfransico’);

Insert Into Customer(‘C132’,’XYZ stores’,’California’);

Insert into Orderdata(‘o123’,’12-aug-2016’,’12-aug-2016’,’A123’,5,2.5,12.5,’c123’);

Insert into Orderdata(‘o124’,’14-aug-2016’,’14-aug-2016’,’B123’,5,15,75,’c132’);

_____________________________________________________________

Enhance your Module 5 CT database table structures, via your selected RDBMS, as you wish.

Then, using SQL and an SQL script file, add at least five more rows of data to each of your tables.

Then, using SQL and an SQL script file, create and execute advanced queries of your choice that demonstrate each of the following:

The use of a GROUP BY clause, with a HAVING clause, and one or more group functions

The use of UNION operator

The use of a subquery

The use of an outer join

Then create and execute at least one SQL UPDATE and at least one SQL DELETE query.

Finally, create and use an SQL view and in a SELECT query.

Submit the following outputs of your SQL script file processing, in this order and appropriately labeled, in a single Word file:

The SQL and results of your INSERT statements to further populate your tables

The SQL and results of your 4 advanced SELECT queries

The SQL and results of your UPDATE and DELETE queries

The SQL and results of your view creation and its use in a SELECT query

You must show all of your SQL as it executed in Management Studio or other development environments. This includes the results returned by your selected RDBMS.

(((((((((((Note)))))))))))))))): you must populate any other tables and show the execution of your SQL statements as required.

Use a SELECT statement using the UNION operator.

add at least 5 more rows to each of your tables

create a view and use it in a SELECT query...

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

-- Add at least five more rows of data to each of your tables.

Insert Into Item values(‘C123’,’Marker’,25);

Insert Into Item values(‘D123’,’Paint Brush’,255);

Insert Into Item values(‘E123’,’PPP’,2);

Insert Into Item values(‘F123’,’PBr’,285);

Insert Into Item values(‘G123’,’Parker’,1);

Insert Into Customer(‘H123’,’ABCF Gen stores’,’New Jersey’);

Insert Into Customer(‘D132’,’XYZF stores’,’California’);

Insert Into Customer(‘E123’,’ABCD Gen stores’,’New York’);

Insert Into Customer(‘F123’,’ABCE Gen stores’,’Pitsburgh’);

Insert Into Customer(‘G123’,’ABCF Gen stores’,’Sanfransico’);

Insert into Orderdata(‘o223’,’13-aug-2016’,’13-aug-2016’,’G123’,5,1,12.5,’e123’);

Insert into Orderdata(‘o324’,’15-aug-2016’,’16-aug-2016’,’B123’,5,15,75,’d132’);

Insert into Orderdata(‘o423’,’17-aug-2016’,’17-aug-2016’,’C123’,5,25,12.5,’h123’);

Insert into Orderdata(‘o523’,’18-aug-2016’,’18-aug-2016’,’D123’,5,255,12.5,’f123’);

Insert into Orderdata(‘o623’,’19-aug-2016’,’22-aug-2016’,’E123’,5,2,12.5,’g123’);

--- The use of a subquery

Select * from Orderdata where ItemId  in (select     ItemId   from item where unitcost=255);

---- Then create and execute at least one SQL UPDATE and at least one SQL DELETE query.

Update Query : Update item Decription            = ‘BBBBB’ where itemId =’A123’

Delete Query : Delete from item where itemid=’A123’

Add a comment
Know the answer?
Add Answer to:
Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primar
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
  • Create a procedure to update the sales history table following the requirements below. A table creation...

    Create a procedure to update the sales history table following the requirements below. A table creation script is provided below. a) Call the procedure: UPDATE_SALES_HISTORY (The procedure name is important for our scripts to test and grade your code; please do not rename it (otherwise our scripts will not run and your score will be 0). b) The procedure takes 2 parameters: (4-digit-year, 2-digit-month). Both parameters will be numeric, e.g., (2019, 11) will denote 2019 (year) and November (month). The...

  • Here is the P4 university database ---Drop tables --Drop Table FACULTY Cascade Constraints; --Drop Table OFFERING...

    Here is the P4 university database ---Drop tables --Drop Table FACULTY Cascade Constraints; --Drop Table OFFERING Cascade Constraints; --Drop Table STUDENT Cascade Constraints; --Drop Table COURSE Cascade Constraints; --Drop Table ENROLLMENT Cascade Constraints; Create Table STUDENT( Std_ID NUMBER(3) Constraint Student_STD_ID_FK PRIMARY KEY, Std_FN Varchar2 (9), Std_LN Varchar2 (8) , Std_City Varchar2 (10), Std_State Varchar2 (4), Std_Zip Number (5), Std_Major Varchar2 (6), Std_Class Varchar2 (3), Std_GPA NUMBER (3,2)); ---Insert records into Student Insert Into STUDENT Values( 101, 'Joe', 'Smith','Eau Clare','WI',18121,'IS','FR',3.8); Insert...

  • Database For this lab you will be using SQL SELECT statements to query your database tables....

    Database For this lab you will be using SQL SELECT statements to query your database tables. You will be turning in the results of the following queries: 1. List all Patients and what Bed they are assigned to 2. List all patients who had Treatments and what Treatment they received 3. List all patients who had tests and what Test they had 4. List the employees (doctors, nurses, etc.) who assisted each patient. 5. List all patients in alphabetical order...

  • I need help for SQL homework. the question: the code for part 1,2: drop table Customer;...

    I need help for SQL homework. the question: the code for part 1,2: drop table Customer; drop table Company; drop table Cruise; drop table TravelAgent; drop table Reservation; drop sequence customerID_seq; drop sequence cruiseID_seq; drop sequence travelAgentID_seq; drop sequence reservationID_seq; create table Customer( customerID number, firstName varchar2(15), lastName varchar2(15), address varchar2(30), phone number(10) not null, age number(3), Constraint Customer_PK Primary Key (customerID), constraint Customer_unique unique (firstName,lastName,phone), constraint Customer_check check(phone is not null) ); create sequence customerID_seq start with 1 increment...

  • Please help me on the SQL queries, thank you so much. Write a query to display the title and publisher as well as the p...

    Please help me on the SQL queries, thank you so much. Write a query to display the title and publisher as well as the publisher contact for each book using JOIN...USING clause. Write a query to show the first and last names of customers who have ordered cooking books. Use the WHERE clause to join the tables. Write a query to show the title, cost and ISBN of each book in the books table. If the book has been ordered,...

  • SQL I have a database CREATE TABLE vendor ( vid CHAR(2) NOT NULL, vname VARCHAR(25) NOT...

    SQL I have a database CREATE TABLE vendor ( vid CHAR(2) NOT NULL, vname VARCHAR(25) NOT NULL, PRIMARY KEY (vid) ); CREATE TABLE category ( catid CHAR(2) NOT NULL, catname VARCHAR(25) NOT NULL, PRIMARY KEY (catid) ); CREATE TABLE product ( pid CHAR(3) NOT NULL, pname VARCHAR(25) NOT NULL, price NUMERIC (7,2) NOT NULL, vid CHAR(2) NOT NULL, categoryid CHAR(2) NOT NULL, PRIMARY KEY (pid)); CREATE TABLE region ( rid CHAR NOT NULL, rname VARCHAR(25) NOT NULL, PRIMARY KEY (rid)...

  • I am using oracle sql developer to create some queries to generated reports and it is...

    I am using oracle sql developer to create some queries to generated reports and it is not working. I am not sure how to use count, group by, and order by. Help me fix my query and explain to me how you did, so can do it next time. Also, I have to convert this query to a stored procedure, so can you help me do it too? Here is my query: SELECT COUNT(GUEST.FIRSTNAME), GUEST.FIRSTNAME, GUEST.LASTNAME, GUEST.GUESTTYPE, RESERVATION.RESERVATIONDATE, GUEST.EMAIL, FROM...

  • The lab for this week addresses taking a logical database design (data model) and transforming it...

    The lab for this week addresses taking a logical database design (data model) and transforming it into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the zip file titled CIS336Lab3Files from Doc Sharing. This zip file contains the ERD, Data Dictionary, and test data for the tables you create as you complete this exercise. Your job will be to use the ERD Diagram found below as a guide to define the...

  • use SQL to answer the question. Create two tables and insert atleast 7 or 8 values(whatever...

    use SQL to answer the question. Create two tables and insert atleast 7 or 8 values(whatever you want) into each of these two tables 1) Person 2) Favorite food I need every step-codes such as : SQL> connect admin/admin as sysdba; SQL> create table products_tb1 2 (prod_id integer primary key, 3 prod_desc char(30), 4 cost real); SQL> insert into products_tb1 values(11235, 'WITCH COSTUME', 29.99); SQL> insert into products_tb1 values(222, 'PLASTIC PUMKIN 18 INCH', 7.75); SQL> insert into products_tb1 values(13, 'FALSE...

  • Chapter 2 How to use the Management Studio Before you start the exercises... Before you start...

    Chapter 2 How to use the Management Studio Before you start the exercises... Before you start these exercises, you need to install SQL Server and the SQL Server Management Studio. The procedures for doing both of these tasks are provided in appendix A of the book. In addition, you'll need to get the Exercise Starts directory from your instructor. This directory contains some script files that you need to do these exercises. Exercises In these exercises, you'll use SQL Server...

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