Question

1.Write a pl/SQL block that selects all the rows from the A2order table and prints them...

1.Write a pl/SQL block that selects all the rows from the A2order table and prints them to screen. THIS CAN BE EASILY DONE USING AGGREGATE FUNCTIONS, BUT YOU MUST NOT USE AGGREGATE FUNCTIONS IN THIS ASSIGNMENT 2.

2.Write a pl/sql block that deletes the orders from the A2order table that were ordered after the order that has the highest order_price (Order_date will tell you when a row was entered). YOU MUST USE BULK OPERATIONS FOR THIS CODE

3. Write a pl/sql block that will select orders from A2order table based on the following condition • The price of the order is higher than the order that was immediately made before this order and lower than the order that was immediately made after the order.

Then Insert the selected row to A2Myorder Table Below is the creation scripts for the tables

CREATE TABLE A2order

(Order_ID VARCHAR2(12)

PRIMARY KEY,

Order_Date DATE,

Order_Price NUMBER(5,2),

Order_category VARCHAR2(12));

CREATE TABLE A2myorder

(OrderID NUMBER PRIMARY KEY,

Order_Date DATE, Order_Price NUMBER(5,2).

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

1.SELECT * FROM TABLE A2order;

2.DELETE FROM A2order WHERE Order_Price IN ( SELECT MAX(Order_Price ) FROM Order_Price );   ;

3.SELECT * FROM TABLE A2order WHERE MAX(Order_Date );

Add a comment
Know the answer?
Add Answer to:
1.Write a pl/SQL block that selects all the rows from the A2order table and prints them...
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
  • Write PL/SQL Procedure that returns the names of people who spent over $100. Create table Resturauntorder...

    Write PL/SQL Procedure that returns the names of people who spent over $100. Create table Resturauntorder ( resturauntorder_id int, resturaunt_name varchar2(50), hotel_name varchar2(50), customer_name varchar2(50), order_date date, items_orderd varchar2(100), order_total decimal(5,2), payment_type varchar2(50), tip_amount decimal(5,2), primary key(resturauntorder_id) ); Insert into Resturauntorder values (123,'Terrace Restaurant', 'Hilton Palm Springs', 'John Smith', date '2019-01-10', 'Omelet Pan, Cinnamon French Toast, California eggs, Orange Juice', 60.49, 'cash', 10.33); Insert into Resturauntorder values (345,'Spiaggia', 'Hilton Chicago/Magnificent Mile Suite','Ashley Scott', date '2019-02-21', 'Polpo, Tonno Vitellato, Rabarbaro', 189.29,...

  • Given the following table structure, write the SQL code to display all the first and last...

    Given the following table structure, write the SQL code to display all the first and last names of the individuals that have a last name that begins with the letter 'M! CREATE TABLE Persons Personi int LastName varchar(80). FirstName varchar(80). Address varchar(125). State char(2) Given the following table structure, write the SQL code to display all the first and last names of the individuals that have a last name that does not contain the letter 'S: CREATE TABLE Persons PersonlDint,...

  • For each city, list number of customers from the city, who have placed order(s). Cities are...

    For each city, list number of customers from the city, who have placed order(s). Cities are listed in ascending alphabetical order. Use equal join for this query. CREATE TABLE customer ( cust_id number(11,0) not null, cust_name varchar2(25) not null, street varchar2(30), city varchar2(20), state varchar2(2), zipcode varchar2(5), CONSTRAINT customer_pk PRIMARY KEY (cust_id) ); CREATE TABLE ordertable ( order_id number(11,0) not null, order_date date, cust_id number(11,0), CONSTRAINT order_pk PRIMARY KEY (order_id), CONSTRAINT order_fk FOREIGN KEY (cust_id) REFERENCES customer (cust_id)); CREATE TABLE...

  • (PL/SQL Programming) Consider the table EMPLOYEE with attributes ID, Name, and Hours, and the table PAYINFO...

    (PL/SQL Programming) Consider the table EMPLOYEE with attributes ID, Name, and Hours, and the table PAYINFO with attributes Regular, Overtime, and HourLimit, defined and populated by the following script: DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE EMPLOYEE (        ID            CHAR(5),        Name          VARCHAR2(16),        Hours         NUMBER(2),        CONSTRAINT PK_EMPLOYEE               PRIMARY KEY (ID) ); INSERT INTO EMPLOYEE VALUES ('22144', 'Anderson', 30); INSERT INTO EMPLOYEE VALUES ('31902', 'Bruford', 45); INSERT INTO EMPLOYEE VALUES ('42771', 'Wakeman', 20); INSERT INTO EMPLOYEE VALUES...

  • Write a pl/sql block of code that will make a reservation for a customer for any...

    Write a pl/sql block of code that will make a reservation for a customer for any destination. The destination id, number of peolpe going and date will be entered by the user. Your code should calculate the cost and enter the data in the sales table. No destination can have more than 10 people going during the same dates. If the number is greater than 10 raise 'Sold_out' exception and print a message 'Sorry we are sold out for ths...

  • Write SQL Queries Given the following tables (7pts) Retrieve the names of employees and their project...

    Write SQL Queries Given the following tables (7pts) Retrieve the names of employees and their project name. If the employee never worked on a project, show the names only the name, not the project name. (7pts) Retrieve the names of employees who have worked on the same project at a different location. (7pts) Retrieve the names of employees who have worked on more than two different projects. (7pts) Retrieve the names of employees who manage more than two employees. CREATE...

  • An online company sells hundreds of office supply products on its e-Commerce store. It has asked...

    An online company sells hundreds of office supply products on its e-Commerce store. It has asked you to design and implement a sales order processing system which will be used by users in our Operations department to process sales orders. Here is an overview of the sales order process. Customers make purchases by placing orders. Each customer has a customer number and profile (such as name, shipping address). To simplify the matter, each time an order is placed, only one...

  • 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...

  • 1) Write a SQL code in order to create a table name Employee with Emp_ID (3...

    1) Write a SQL code in order to create a table name Employee with Emp_ID (3 characters), Last_Name (20 characters), and First_Name (15 characters), the primary key is Emp_ID (Note: make sure this code will run on SQL view on Access database) 2) Write a SQL code to remove the table Employee that will remove both the structure and the content of the table. (

  • 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,...

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