Question

In: Computer Science

For Problems 1–4, using the STORES Database, formulate SQL queries, Hand in a listing of each...

For Problems 1–4, using the STORES Database, formulate SQL queries, Hand in a listing of each query and its output.

1. (10 Points) For each customer, list each stock item ordered, the manufacturer, the quantity ordered, and the total price paid. Include the following columns in the order given below:

From Customer Table:              Company

From Stock Table:                      Description

From the Manufact Table:        Manu_Name

From the Items Table:                                Quantity, Total Price

Order the output by Company and Description.

2. (10 Points) List all orders with a shipping date between December 25, 1999 and January 5, 2000. List the Order Number, Order Date, Customer company name, and Shipping Date. Order by Customer Company Name and Order Number.

3. (10 Points) Count the number of customers who do not have any orders placed.

4. (10 Points) List all customers who are ordering equipment whose description begins with ‘tennis’ or ‘volleyball’. List the Customer number, Stock number, and Description. Do not repeat any rows.

5. (15 Points) Use the following SQL CREATE commands to CREATE the following tables in your

User ID:

                                CREATE TABLE Professor

                                (Prof_ID                NUMBER(3) Constraint pk_Professor Primary Key,

                                Prof_Lname         VARCHAR2(15)                 NOT NULL,

                                Prof_Hiredate      DATE,

                                Prof_Sal                NUMBER(8,2),

                                Prof_Dept             CHAR(6)

                                );

                                CREATE TABLE Student

                                (Stu_ID                  NUMBER(4) Constraint pk_Student Primary Key,

                                Stu_Lname           VARCHAR2(15)                 NOT NULL,

                                Stu_Major            CHAR(6),

Stu_CredHrs         NUMBER(4),

                                Stu_GradePts       NUMBER(5),

                                Prof_ID                 NUMBER(3),

                                CONSTRAINT fk_Student_Prof_ID FOREIGN KEY(Prof_ID)

                                                REFERENCES Professor

                                );

Hand in: Print out of the Create commands, the system response and a DESCRIBE of the tables.

6. (15 Points) Insert the following data into the tables created above using SQL INSERT commands.

Professor Table:

Prof_ID

Prof_Lname

Prof_Hiredate

Prof_Sal

Prof_Dept

123

Hilbert

20-MAY-1992

58000.00

MATH

243

Newell

15-JUL-1997

65500.00

CMPSCI

389

Lessing

04-APR-1988

40250.00

ENG

Student Table:

Stu_ID

Stu_Lname

Stu_Major

Stu_CredHrs

Stu_GradePts

Prof_ID

2001

Parker

CMPSCI

52

160

243

2166

Smith

ENG

30

75

389

3200

Garcia

MATH

62

248

123

4520

Smith

CMPSCI

45

157

NULL

Solutions

Expert Solution

create table Professor

(Prof_ID integer,

constraint pk_Professor primary key(Prof_ID),

Prof_Lname varchar(15) not null,

Prof_Hiredate date,

Prof_Sal decimal(8,2),

Prof_Dept varchar(6));

create table Student

(Stu_ID integer ,

constraint pk_Student primary key(STU_ID),

Stu_Lname varchar(15) not null,

Stu_Major varchar(6),

Stu_CredHrs integer,

Stu_GradePts integer,

Prof_ID interger,

constraint fk_Student_Prof_ID foreign key (Prof_ID)  references Professor(Prof_ID));

6. insert into professor values('123','Hilbert','20-MAY-1992','58000.00',’MATH’);

insert into professor values('243','Newell','15-JULY-1997','.65500.00',’CMPSCI’);

insert into professor values('389','Lessing','4-APR-1988','40250.00',’ENG’);

insert into student values('2001','Parker','CMPSCI','52',’160’,’243’);

insert into student values('2166','Smith','ENG','30',’75’,’389’);

insert into student values('3200','Garcier','MATHS','62',’248’,’123’);

QUERY FOR ORACLE SQL


Related Solutions

Please create the SQL queries using the lryics database under question 4 and use "select *...
Please create the SQL queries using the lryics database under question 4 and use "select * from..." after each query to show the effects of your data manipulation query. Thanks for help 1. The title 'Time Flies' now has a new track, the 11th track 'Spring', which is 150 seconds long and has only a MP3 file. Insert the new track into Tracks table (Don’t hand-code any data for insert that can be looked up from the Titles table). 2....
Create the following SQL queries using the lyrics database below 1. List the first name, last...
Create the following SQL queries using the lyrics database below 1. List the first name, last name, and region of members who do not have an email. 2. List the first name, last name, and region of members who do not have an email and they either have a homephone ending with a 2 or a 3. 3. List the number of track titles that begin with the letter 's' and the average length of these tracks in seconds 4....
Write the SQL queries that accomplish the following tasks using the AP Database 9. Write a...
Write the SQL queries that accomplish the following tasks using the AP Database 9. Write a select statement to show the invoicelineitemdescriptions that have the total invoicelineitemamount >1000 and the number of accountno is >2. 10. Write a select statement that returns the vendorid, paymentsum of each vendor, and the number of invoices 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...
Please use the books database pasted under question 4 to design the following SQL queries. Use...
Please use the books database pasted under question 4 to design the following SQL queries. Use any method such as subqueries, equi-join/inner-join, outer join, EXISTS 1. Find the name(s) of the publisher(s) who have published the computer book. 2. Find the name(s) of the author(s) that have authored more than one books. 3. Find the name(s) of the publisher(s) who published the least expensive book. 4. Find the name(s) of the author(s) who wrote the book with the greatest number...
Please use the books database pasted under question 4 to design the following SQL queries. Use...
Please use the books database pasted under question 4 to design the following SQL queries. Use any method such as subqueries, equi-join/inner-join, outer join, EXISTS 1. List the title_name and book type of the books that are published earlier than the earliest biography book 2. List the title_name and book type of the books published by 'Abatis Publishers' 3. Find the name(s) of the publisher(s) that have not published any book 4. Find the name(s) of the publisher(s) who have...
This is t a relational database please write SQL queries to solve the listed questions. The...
This is t a relational database please write SQL queries to solve the listed questions. The database is a variation of the “Movie Database” . There are several differences in it, so look it over carefully before writing your SQL queries Notes: TheaterNum, MovieNum, and ActorNum are numeric primary key fields in their respective tables. Movie and actor names are not assumed to be unique unless specified otherwise in a question. In the THEATER table, Capacity is the number of...
Basic SQL Use the following schema to answer the queries below using SQL DEVICE [dno, dtype,...
Basic SQL Use the following schema to answer the queries below using SQL DEVICE [dno, dtype, price] PROVIDER [pno, pname, web] SERVICE [dno, pno, servicedate] SERVICE.dno references DEVICE.dno SERVICE.pno references PROVIDER.pno bold is underline. a) Find the dno for the most expensive device b) Find all providers that have the work fast in the name c) Find the number of different device types (dtype) d) Give all details of devices with price more than $400
Using your downloaded DBMS (MS SQL Server or MySQL), write SQL queries that inserts at least...
Using your downloaded DBMS (MS SQL Server or MySQL), write SQL queries that inserts at least three rows in each table. For the On-Demand Streaming System, First, insert information for multiple users, at least three video items and insert the three different types of subscriptions (Basic, Advanced, Unlimited) into the database. Then insert at least three user subscriptions. Execute the queries and make sure they run correctly
LP3.1 Assignment: Using Advanced SQL This assignment will assess the competency 3. Construct advanced SQL queries....
LP3.1 Assignment: Using Advanced SQL This assignment will assess the competency 3. Construct advanced SQL queries. Directions: Using the sample dataset, create three queries including a search, outer join and subquery. Create a table on how to use the query optimizer with these queries. Include screenshots and an explanation on why and when to use the optimizer. .
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft...
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft Access, Oracle, or MySQL) as indicated by your professor. After creating the database – populate it with some data (could be made up). SQL syntax and the DB application will be discussed and taught in class. This is the final deliverable of the group project. Assignment is due by the due date as indicated by your professor. *Make sure to submit the completed database...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT