Question

Table Name: Salary Name Type Income Abby 1 100,000 Brendan 1 100,000 Colin 1 100,000 Dean...

Table Name: Salary

Name Type Income
Abby 1 100,000
Brendan 1 100,000
Colin 1 100,000
Dean 2 200,000
Elena 2 200,000

For the table above, write a concise MySql statement that produces:

2 Columns. Each column has the average Income of the twoTypes.

Target:

Type1 Type2
       100,000        200,000
0 0
Add a comment Improve this question Transcribed image text
Answer #1

NOTE: I created your table and insert all the data below is the query by which you can get your required result here i am using inner query for type2 . Please like it.

ANSWER:

SELECT AVG(income) as Type1 ,(Select AVG(income) from Salary WHERE Type=2) as Type2
FROM Salary
WHERE Type=1 ;

OUTPUT:

SELECT AVG(income) as Typel , (Select AVG(income) from Salary WHERE Type=2) as Type2 FROM Salary WHERE Type=1 ; Edit the SQL

Add a comment
Know the answer?
Add Answer to:
Table Name: Salary Name Type Income Abby 1 100,000 Brendan 1 100,000 Colin 1 100,000 Dean...
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
  • 1. Answer the questions with respect to the table below. users gender id name age occ_id...

    1. Answer the questions with respect to the table below. users gender id name age occ_id city_id John 25 M 3 1 2. Sara 20 F 3 4 3 Victor 31 M 2 LO 4 Jane 27 F 1 3 occupation id name 1 2 Software Engineer Accountant Pharmacist Library Assistant 3 City id name 1 2 Halifax Calgary Boston 3 4 New York 5 Toronto (b) [2.5+2.5+5) Write query to make a copy of 'users' table known as 'users_new'....

  • rider_student Column Data Type Description student_id integer the primary key first_name varchar(25) student first name last_name...

    rider_student Column Data Type Description student_id integer the primary key first_name varchar(25) student first name last_name varchar(25) student last name major_id integer the ID of the student's major; a foreign key for the major_id in the rider_major table rider_major Column Data Type Description major_id integer the primary key major_name varchar(50) student first name major_description varchar(100) student last name Use the Tables above to answer the questions. Questions: 1. Write a SQL statement to add a student record to the rider_student...

  • IN THE PREVIOUS CHAPTER WE MADE A DATABASE USING OUR LAST NAME AS ITS NAME. QUESTION...

    IN THE PREVIOUS CHAPTER WE MADE A DATABASE USING OUR LAST NAME AS ITS NAME. QUESTION 1 STATES THIS. PLEASE TYPE WHAT NEEDS TO BE TYPED FOR ALL STEPS. THIS USES CODIO a. 1. Connect to the database you created and named in Module One (for example, Jetson). Type after the prompt mysql> a. use (table you named); i. Example: mysql> use Jetson; 2. Create the Employee table using the SQL statement shown here. Press Return after each line. CREATE...

  • c++ language 1) Create a function that prints a greeting when called with a name such...

    c++ language 1) Create a function that prints a greeting when called with a name such as greeting ("Elona") 2) Create a function that squares a double number and returns the result as a double. 3) Create a function that takes 5 int numbers and returns the average as a float 4) Create a single function that gives a greeting, calculates the average of 5 grades but does not return a value. Hint: Use return type void and a string...

  • 1. Create a table that will hold the data in avgprice kwh state.csv. This .csv file...

    1. Create a table that will hold the data in avgprice kwh state.csv. This .csv file contains the annual data from 1990-2012 on the average energy price per kilowatt hour (KwH) by state and provider type. Implement the following queries: • Print each row that has Tennessee as state, order the result by year in descending order. • Print the average residential, commercial, industrial, and transportation price for the state of Texas from the year 1990-2012. 2. Create the tables...

  • Financial statement Data Table a. In column (1) indicate b. In column (2), indicate whether the...

    Financial statement Data Table a. In column (1) indicate b. In column (2), indicate whether the account is a current asset account identification Mark each of the accounts listed in the following tablE asfollows in which stabement-income statement (1S) or balance sheet (BS)-the account belongs (CA), current Sability (CL), expense (E), fxed asset (FA) Select from the drop down menus) Account Name Accounts payable Accounts receivable Accuals Accumulated depreciation Administrative expense Statement Type of Account Account Name Accounts payable Type...

  • Q.5] Answer the following questions based on the company database (based on the homework assignment 2) y dat...

    Q.5] Answer the following questions based on the company database (based on the homework assignment 2) y database (based on the homework assignment 2) 3 IPage 1. For each department whose average employee salary is more than $30,000, write a SQL statement to retrieve the department name and the number of employees working for that department 2. Write a SQL statement to retrieve first name, last name, and address of each employee who lives in Houston, TX. 3. Write a...

  • Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates...

    Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates to the following tables: • Employee table (project 1) create table Employee ( empNumber char(8) not null, firstName varchar(25) null, lastName varchar(25) null, ssn char(9) null, address varchar(50) null, state char(2) null, zip char(5) null, jobCode char(4) null, dateOfBirth date null, certification bit null, salary money null, constraint PK_EMP PRIMARY KEY(empNumber), constraint EMP_STATECHECK CHECK(state in ('CA','FL')) ) GO • Job table (project 1) create...

  • SQL/Oracle EMPLOYEE Table ID NAME GENDER SALARY COUNTRY 1 Mark Male 5000 USA 2 John Male...

    SQL/Oracle EMPLOYEE Table ID NAME GENDER SALARY COUNTRY 1 Mark Male 5000 USA 2 John Male 4500 Canada 3 Pam Female 5500 USA 4 Sara Female 4000 Canada 5 Todd Male 3500 Canada 6 Mary Female 5000 UK 7 Ben Male 6500 UK 8 Elizabeth Female 7000 USA 9 Tom Male 5500 UK 10 Ron Male 5000 USA Given the EMPLOYEE table above, write a query that would produce the output below. COUNTRY    GENDER     Total Salary ---------- ---------- ------------ Canada     Female             4000 Canada     Male               8000 UK         Female             5000...

  • Step 1. Open Excel and complete first two columns with any numbers Make 7-8 rows. Type...

    Step 1. Open Excel and complete first two columns with any numbers Make 7-8 rows. Type below first column "R = " We will use Excel function CORREL(Array-1, Array-2). STEP 2. Click on cell B11 and type: =CORREL( Highlight all numbers in A-column starting with cell A2 (do not include title). That will be Array-1 (input range). Type comma after Array-1 and highlight Array-2 from B-column. Press ENTER. You will see in cell B11 Coefficient of Linear Correlation. STEP 3....

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