Question

1.Write a SELECT statement that returns "Representative full name" from sales_rep table. Format "Representative full name"...

1.Write a SELECT statement that returns "Representative full name" from sales_rep table. Format "Representative full name" column with the rep_first_name column , a comma, a space and the rep_last name. Return only the sales representatives whose last name starts with "Mar"

2. Write a SELECT statement that  joins the sales_rep table to the sales_totals table using JOIN clause and returns these columns : "Representative Last name" : rep_last_name from sales_rep table " Year of sales " : sales_year column of sales_totals table "Total sales " : sales_total column of sales_totals table

Homework Answers

Answer #1

1.SELECT  rep_first_name+','+' '+rep_last_name as Representative_full_name where Left(rep_last_name,3)='Mar'

OR

SELECT CONCAT(rep_first_name,',',' ',rep_last_name) as Representative_full_name where Left(rep_last_name,3)='Mar' (P.S - When you run in MYSQL,use CONCAT() function)

2.SELECT sales_rep.rep_last_name as Representative_Last_name,sales_totals.sales_year as Year_of_sales,sales_totals.sales_total as Total_sales FROM sales_rep INNER JOIN sales_totals ON (JOIN condition to be mentioned)

Know the answer?
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
Similar Questions
In SQL working with data types 1. Write a SELECT statement that returns these columns from...
In SQL working with data types 1. Write a SELECT statement that returns these columns from the Instructors table: a. The monthly salary (the AnnualSalary column divided by 12) b. A column that uses the CAST function to return the monthly salary with 1 digit to the right of the decimal point c. A column that uses the CONVERT function to return the monthly salary as an integer d. A column that uses the CAST function to return the monthly...
Write a SQL statement which joins the parts table with the supplier table and lists the...
Write a SQL statement which joins the parts table with the supplier table and lists the part_name, supplier_name for all parts in the part table. The supplier_id column in the suppliers table is the primary key in the suppliers table, and this key has been exported to the parts table where it is a foreign key. You should use an inner join for this query. Write a SQL statement which joins the parts table with the suppliers table and lists...
Write a SELECT statement that returns one row for each general ledger account number that contains...
Write a SELECT statement that returns one row for each general ledger account number that contains three columns: The account_description column from the General_Ledger_Accounts table The count of the items in the Invoice_Line_Items table that have the same account_number. The sum of the line_item_amount columns in the Invoice_Line_Items table that have the same account_number Return only those rows where the count of line items is greater than 1. This should return 10 rows. Group the result set by the account_description...
in mysql 3. Write a SELECT statement that returns one row for each customer that has...
in mysql 3. Write a SELECT statement that returns one row for each customer that has orders with these columns:   The email_address column from the Customers table   The sum of the item price in the Order_Items table multiplied by the   quantity in the Order_Items table   The sum of the discount amount column in the Order_Items table   multiplied by the quantity in the Order_Items table   Sort the result set in descending sequence by the item price total for each customer.  
Class-In Assignment 3: Chapters 4&5 How to retrieve data from two or more tables Exercises 1....
Class-In Assignment 3: Chapters 4&5 How to retrieve data from two or more tables Exercises 1. Write a SELECT statement that returns all columns from the Vendors table inner-joined with all columns from the Invoices table. 2. Write a SELECT statement that returns four columns: vendor_name vendor_name from the Vendors table invoice_number invoice_number from the Invoices table invoice_date invoice_date from the Invoices table balance_due invoice_total minus payment_total minus credit_total from the Invoices table The result set should have one row...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL CPTR HIST MATH RELB Data Type Text Text Text Text Text Number Currency Date/Time Text DEPT_TITLE Biology Computer Science History Mathematics Religion    Field Name DEPT_CODE DEPT_TITLE Data Type Text Text INSTRUCTIONS Use SQL commands to create the tables and enter the data shown above using MS Access. Write the following SQL statement given below: 1. 2. 3. 4. 5. 6. 7. 8. 9....
Write a SELECT statement that uses aggregate window functions to calculate the order total for each...
Write a SELECT statement that uses aggregate window functions to calculate the order total for each musician and the order total for each musician by date. Return these columns: The musician_id column from the Orders table The order_date column from the Orders table The total amount for each order item in the Order_Items table The sum of the order totals for each musician The sum of the order totals for each musician by date (Hint: You can create a peer...
Lab 5 Queries with Multiple Tables In this lab, we do queries more than one table....
Lab 5 Queries with Multiple Tables In this lab, we do queries more than one table. SQL provides two different techniques for querying data from multiple tables: • The SQL subquery • The SQL join As you will learn, although both work with multiple tables, they are used for slightly different purposes. We used WMCRM database which is what we created in Lab 4. Here is the summary of the database schema (where schema is used in its meaning of...
The following question is based on this table named Customer Column Name     Type              CustId          Integer P
The following question is based on this table named Customer Column Name     Type              CustId          Integer Primary Key, CustName        Varchar2(40), Balance         Number Gender          Varchar2(1) Write the Stored Function named GetCustDetails.       The function: Has one parameter named pCustName. Must return a text value Must search for a customer row that has a CustName value equal to pCustName If a match is found return the customer's name and balance in the following format: Customer Name: Fred   Gender M   Balance 20000 If a...
1. What are three uses for a view? 2. Create a table named COPY_customers from the...
1. What are three uses for a view? 2. Create a table named COPY_customers from the customers table. 3. Use the CREATE or REPLACE option to create a view of all the columns in the COPY_customers table called view_ customers. 4. Use view_ customers to INSERT a row of data into the underlying COPY_customers table. Execute a SELECT * from COPY_customers to verify your DML command. 5. Show the contents of the view_ customers view. 6. Write the statement to...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT