Question

What would I have to write into the MySQL Workbench query to execute these commands?


- Show all vendor information with vendor contact information in upper case like "SMITH".

- Show the customer balance in total, in average, in minimized and in maximized value.

- Show all customer information whose balance is greater than $500.

- Aggregate the total cost of products grouped by V_CODE, and only show the records with total exceeds $500, and list the records in descending order in total cost.

- Join PRODUCT table and VENDOR table on V_CODE.

- Show all records from PRODUCT that price is above the average price.LINE CUSTOMER PK CUS CODE | Hit generates PK,FK1 INVOICE PK INV NUMBER FK1 CUS_CODE INV DATE РК INV NUMBER LINE NUMBER FK2 CU

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

- Show all vendor information with vendor contact information in upper case like "SMITH".

SELECT *
FROM VENDOR
WHERE V_CONTACT REGEXP '^[A-Z]+$';


- Show the customer balance in total, in average, in minimized and in maximized value.

SELECT SUM(CUS_BALANCE) as Total,AVG(CUS_BALANCE) as Average,MIN(CUS_BALANCE) as Minimum,MAX(CUS_BALANCE) as Maximum
FROM CUSTOMER;

- Show all customer information whose balance is greater than $500.

SELECT *
FROM CUSTOMER
WHERE CUS_BALANCE >500;


- Aggregate the total cost of products grouped by V_CODE, and only show the records with total exceeds $500, and list the records in descending order in total cost.


SELECT *
FROM PRODUCT
GROUP BY V_CODE
HAVING SUM(P_PRICE) >500
ORDER BY SUM(P_PRICE);


- Join PRODUCT table and VENDOR table on V_CODE.

Select *
FROM PRODUCT as a INNER JOIN VENDOR as b
ON a.V_CODE = b.V_CODE;


- Show all records from PRODUCT that price is above the average price.

SELECT *
FROM PRODUCT
HAVING P_PRICE > AVG(P_PRICE);

Add a comment
Know the answer?
Add Answer to:
What would I have to write into the MySQL Workbench query to execute these commands? -...
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
  • Need to find the partial and transitive dependencies of the following fields: cust_code = code that...

    Need to find the partial and transitive dependencies of the following fields: cust_code = code that identifies a customer cus_lname = customer last name cus_areacode = area code of the 7 digit phone number of a customer cus_initial = customer initials cus_balance = balance to be paid by the customer cus_phone = 7 digit phone number cus_fname = customer first name inv_number = number representing an invoice inv_date = date of the invoice line_number = an invoice contains many items...

  • this is about databases and SQL, please help me with this and i promise i will...

    this is about databases and SQL, please help me with this and i promise i will thumbs you up :) let me know if you need more info please try to get this done i will definitely thumbs you up :)) PROJECT TOPIC: Library: Books, Copies of the books, Patrons, Checkouts when creating ERD diagram, the notation must be in crows notation, attached at the bottom is an example of crows foot notation in databases so you can understand. PDF...

  • this is about databases and SQL, please help me with this and i promise i will...

    this is about databases and SQL, please help me with this and i promise i will thumbs you up :) let me know if you need more info please try to get this done i will definitely thumbs you up :)) PROJECT TOPIC: Library: Books, Copies of the books, Patrons, Checkouts when creating ERD diagram, the notation must be in crows notation, attached at the bottom is an example of crows foot notation in databases so you can understand. PDF...

  • 2. Find the maximum QOH of all products. it generates INVOICE PK IN NUMBER FK1CuS_CODE INV_DATE...

    2. Find the maximum QOH of all products. it generates INVOICE PK IN NUMBER FK1CuS_CODE INV_DATE contains CUSTOMER PK CUS_CODE CUS_LNAME CUS FNAME CUS INITIAL CUS AREACODE CUS PHONE CUS_BALANCE + LINE PKFK1 INV_NUMBER +PX LINE NUMBER FK2 P CODE LINE_UNITS LINE_PRICE is found in VENDOR PKY_CODE V_NAME CONTACT HF - Supplies PRODUCT PK ecoot P_DESCRIPT P_INDATE P QOH P_MIN P PRICE P_DISCOUNT FK1V_CODE V_AREACODE V_PHONE V_STATE V_ORDER

  • Answer all questions on paper: Consider the database model below The database model FIGURE 7.1 CUSTOMER...

    Answer all questions on paper: Consider the database model below The database model FIGURE 7.1 CUSTOMER INVOICE LINE PK CUS CODE INV NUMBER FK1 CUS_COOE NV DATE CUS LNAME CUS FNAME CUS INITIAL CUS AREACODE CUS PHONE CUS BALANCE LINE UNITS LINEPRICE - isfound in VENDOR PRODUCT V NAME supplies P INDATE P DESCRIPT CONTACT de- V AREACODE V PHONE V STATE V ORDER ?,.QOH P MIN P PRICE Write the SQL code for creating the database and all the...

  • Question 1. For each table, identify the primary key and the foreign key(s). If a table...

    Question 1. For each table, identify the primary key and the foreign key(s). If a table does not have a foreign key, write None. Question 2. Do the tables exhibit entity integrity? Answer yes or no, and then explain your answer. Question 3. Do the tables exhibit referential integrity? Answer yes or no, and then explain your answer. Write NA (Not Applicable) if the table does not have a foreign key. Question 4. Describe the type(s) of relationship(s) between CUSTOMER...

  • Using the ch08_saleco database write a T-SQL query to display the customer code, invoice number invoice...

    Using the ch08_saleco database write a T-SQL query to display the customer code, invoice number invoice date, and invoice subtotal from invoice conditioned on the invoice subtotal is greater than $100 and from only customer codes 10011 and 10012. (hint: in) /* Database Systems, 8th Ed., Rob/Coronel */ /* Type of SQL : SQL Server */ CREATE TABLE CUSTOMER ( CUS_CODE int, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT...

  • Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB...

    Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB4DB; USE LAB4DB; CREATE TABLE CUSTOMER ( CUS_CODE int primary key, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT INTO CUSTOMER VALUES('10011','Dunne','Leona','K','713','894-1238','0'); INSERT INTO CUSTOMER VALUES('10012','Smith','Kathy','W','615','894-2285','345.86'); INSERT INTO CUSTOMER VALUES('10013','Olowski','Paul','F','615','894-2180','536.75'); INSERT INTO CUSTOMER VALUES('10014','Orlando','Myron','','615','222-1672','0'); INSERT INTO CUSTOMER VALUES('10015','O''Brian','Amy','B','713','442-3381','0'); INSERT INTO CUSTOMER VALUES('10016','Brown','James','G','615','297-1228','221.19'); INSERT INTO CUSTOMER VALUES('10017','Williams','George','','615','290-2556','768.93'); INSERT INTO CUSTOMER VALUES('10018','Farriss','Anne','G','713','382-7185','216.55'); INSERT INTO CUSTOMER VALUES('10019','Smith','Olette','K','615','297-3809','0'); /*...

  • Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL...

    Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX /* Database Systems, Coronel/Morris */ /* Type of SQL : SQL Server */ /* WARNING: */ /* WE HIGHLY RECOMEND...

  • * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following...

    * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following tables: VENDOR, PRODUCT, CUSTOMER, INVOICE, LINE EMPLOYEE and loads the default data rows */ set echo on; set serveroutput on; select systimestamp from dual; show user; ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'; DROP TABLE LINE CASCADE CONSTRAINTS; DROP TABLE INVOICE CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE VENDOR CASCADE CONSTRAINTS; DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE...

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