Consider the following relation:

Works (emp_name, company_name, salary)

Here, emp_name is primary key.

Consider the following SQL query

Select emp_name

From Works T

where salary>(select avg (salary)

from Works S

where T.company_name=

S. Company_name)

The above query is for following:

(1) Find the highest paid employee who earns more than the average salary of all employees of his company.

(2) Find the highest paid employee who earns more than the average salary of all the employees of all the companies.

(3) Find all employees who earn more than the average salary of all employees of all the companies.

(4) Find all employees who earn more than the average salary of all employees of their company.

1 Answer

Answer :

Find all employees who earn more than the average salary of all employees of their company.

Related questions

Description : Suppose ORACLE relation R(A, B) currently has tuples {(1, 2), (1, 3), (3, 4)} and relation S(B, C) currently has {(2, 5), (4, 6), (7, 8)}. Consider the following two SQL queries SQ1 and SQ2 ... (A) 2 and 6 respectively (B) 6 and 2 respectively (C) 2 and 4 respectively (D) 4 and 2 respectively

Last Answer : (D) 4 and 2 respectively

Description : Which of the following is a legal expression in SQL? (A) SELECT NULL FROM EMPLOYEE; (B) SELECT NAME FROM EMPLOYEE; (C) SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL; (D) None of the above

Last Answer : B) SELECT NAME FROM EMPLOYEE;

Description : Consider the following three SQL queries (Assume the data in the people table) : (a) Select Name from people where Age>21; (b) Select Name from people where Height>180; (c) Select Name from people where (Age>21) or (Height ... number of rows returned by the SQL query (c) ? (A) 3 (B) 7 (C) 10 (D) 21

Last Answer : (C) 10

Description : Consider the following two commands C1 and C2 on the relation R from an SQL database:  C1: drop table R; C2: delete from R; Which of the following statements is TRUE? I. Both C1 and C2 delete the schema for R. II. C2 ... R. (A) I only (B) I and II only (C) II and III only (D) I, II and III

Last Answer : (C) II and III only

Description : For execution of DELETE SQL query in JDBC, ............. method must be used. A) executeQuery() B) executeDeleteQuery() C) executeUpdate() D) executeDelete()

Last Answer : C) executeUpdate()

Description : ………………… is a full form of SQL. A) Standard query language B) Sequential query language C) Structured query language D) Server side query language

Last Answer : A) Standard query language

Description : In distributed databases, location transparency allows for database users, programmers and administrators to treat the data as if it is at one location. A SQL query with location transparency needs to specify: (A) Inheritances (B) Fragments (C) Locations (D) Local formats 

Last Answer : (B) Fragments

Description : Write a program to implement single inheritance. Declare base class employee with Emp_No. and Emp_Name. Declare derived class fitness with height and weight. Accept and display data for one employee.

Last Answer : #include<iostream.h> #include<conio.h> class employee { protected: int emp_no; char emp_name[10]; public: void gete() { cout<< enter employee details ; cin>>emp_no; cin>> ... f.gete(); f.pute(); f.getft(); f.putft(); getch(); }

Description : Consider a CUSTOMERS database table having a column CITY filled with all the names of Indian cities (in capital letters). The SQL statement that finds all cities that have GAR somewhere in its name, ... *from customers where city like %GAR%'; (D) Select *from customers where city as '%GAR';

Last Answer : Answer: C

Description : Consider a database table R with attributes A and B. Which of the following SQL queries is illegal ? (A) SELECT A FROM R; (B) SELECT A, COUNT(*) FROM R; (C) SELECT A, COUNT(*) FROM R GROUP BY A; (D) SELECT A, B, COUNT(*) FROM R GROUP BY A, B;

Last Answer : (B) SELECT A, COUNT(*) FROM R;

Description : Consider the relations R(A,B) and S(B,C) and the following four relational algebra queries over R and S: I. πA,B(R⋈S) II. R⋈πB(S) III. R∩(πA(R) Χ πB(S)) IV. πA,R.B(R Χ S) where R.B refers to ... IV are the same query. (C) I, II and IV are the same query. (D) I, III and III are the same query.

Last Answer : (D) I, III and III are the same query.

Description : Let pk(R) denotes primary key of relation R. A many-to-one relationship that exists between two relations R1 and R2 can be expressed as follows: (1) pk(R2)→pk(R1) (2) pk(R1)→pk(R2) (3) pk(R2)→R1∩R2 (4) pk(R1)→R1∩R2

Last Answer : Answer: 2

Description : Consider the table Student(stuid, name, course, marks). Which one of the following two queries is correct to find the highest marks student in course 5? Q.1. Select S.stuid From student S Where not exists (select * from student ... ) Q.1 (B) Q.2 (C) Both Q.1 and Q.2 (D) Neither Q.1 nor Q.2

Last Answer : (B) Q.2 Explanation: First query gives stuid of students whose marks are greater than all students taking course 5. Second query gives stuid of students whose marks are greater than any student taking ... comparison is between maximum of marks by any student in course 5. So the answer is option D.

Description : Manager's salary details are to be hidden from Employee Table. This Technique is called as (A) Conceptual level Datahiding (B) Physical level Datahiding (C) External level Datahiding (D) Logical level Datahiding

Last Answer : (C) External level Datahiding

Description : Consider the following schemas: Branch = (Branch-name, Assets, Branch-city) Customer = (Customer-name, Bank-name, Customer-city) Borrow = (Branch-name, loan-number, customer account-number) Deposit = ... )) (C) πcustomer-name(σbalance> 10000(Borrow)) (D) σcustomer-name(σbalance> 10000(Borrow))

Last Answer : (A) πcustomer-name(σbalance> 10000(Deposit)) 

Description : Consider the following database table : Create table test( one integer, two integer, primary key(one), unique(two), check(one≥1 and ≤10), check(two≥1 and ≤5) ); How many data records/tuples atmost can this table contain ?  (A) 5 (B) 10 (C) 15 (D) 50

Last Answer : (A) 5 

Description : The statement in SQL which allows to change the definition of a table is (A) Alter. (B) Update. (C) Create. (D) select

Last Answer : (A) Alter.

Description : Which one is correct w.r.t. RDBMS? (1) primary key ⊆ super key ⊆ candidate key (2) primary key ⊆ candidate key ⊆ super key (3) super key ⊆ candidate key ⊆ primary key (4) super key ⊆ primary key ⊆ candidate key

Last Answer : Answer: 2

Description : If you are a salary employee, after working 67 hours in one week should you not be paid overtime?

Last Answer : property taxes are fully deductible from your income so you should be able to look on your pay stub. But the address was not a valid address so there was no way to look it up but a website you could use to look up your property taxes is http://www.city-data.com/city/Brooklyn-New-York.html

Description : In a system designed to work out the tax to be paid:An employee has £4000 of salary tax free. The next £1500 is taxed at 10% the next £28000 is taxed at 22%. Any further amount is taxed at 40% ... ) £4800; £14000; £28000 b) £5200; £5500; £28000 c) £28001; £32000; £35000 d) £5800; £28000; £32000

Last Answer : d) £5800; £28000; £32000

Description : In a system designed to work out the tax to be paid: An employee has £4000 of salary tax free. The next £1500 is taxed at 10%. The next £28000 after that is taxed at 22%. Any further amount is taxed ... of these is a valid Boundary Value Analysis test case? A. £28000. B. £33501. C. £32001. D. £1500

Last Answer : B. £33501.

Description : To select tuples with some salary, Siddharth has written the following erroneous SQL statement : -Technology

Last Answer : The correct code is :SELECT ID, Salary FROM empsalaryWHERE Salary = 56000 ;

Description : The average salary per head of all the employees in a company is Rs. 180. The average salary of 24 employees is Rs. 1040and the average salary per head of the rest is Rs. 160. Find the total number of employees in the workshop. A) 2841 B) 1056 C) 1195 D) 2145

Last Answer :  B) Average = Sum of observations/Number of observations Let the number of employees be x. Given, the average salary per head of all the employees in a company is Rs. 180 So, the sum of salary of all the employees in ... (x - 24) = 180x ⇒ 24960+ 160x - 3840 = 180x ⇒ 20x = 2112 ⇒ x = 1056

Description : An investment in buying 400 shares of a company at a premium of Rs.2.50 earns an income of `9.6%` per annum. If the rate of dividend paid by the compa

Last Answer : An investment in buying 400 shares of a company at a premium of Rs.2.50 earns an income of `9.6%` ... `12%`, then find the face value of each share.

Description : Let R and S be two fuzzy relations defined as: Then, the resulting relation, T, which relates elements of universe x to elements of universe z using max-min composition is given by

Last Answer : Answer: C

Description : If employee is citizen of India, working in U.S and employed by company whose headquarters are in Japan then employee is classified as A. third country nationals B. third world employees C. expatriates D. host country nationals

Last Answer : third country nationals

Description : The following is (are) the indirect labour cost(s) A. Wages paid to storekeeper B. Salary of works manager C. Wages paid to gatekeeper D. All of the above

Last Answer : D. All of the above

Description : Sharon Moro, office manager at Willow Manufacturing stated, We d had manufacturing work cells in place for at least two years, but change didn t really happen until we added teamwork. To ... Individual employee success was recognized and celebrated. (d) Employees believed in what they were doing. 

Last Answer : (c) Individual employee success was recognized and celebrated.

Description : A .................. normal form normalization will be needed where all attributes in a relation tuple are not functionally dependent only on the key attribute. A) First B) Second C) Third D) Fourth

Last Answer : C) Third

Description : ………..defines the structure of a relation which consists of a fixed set of attribute-domain pairs. A) Instance B) Schema c) Program D) Super Key

Last Answer : B) Schema

Description : The Relation Vendor Order (V_no, V_ord_no, V_name, Qty_sup, unit_price) is in 2NF because : (A) Non key attribute V_name is dependent on V_no which is part of composite key (B) ... Qty_sup is dependent on primary_key unit price (D) key attribute V_ord_no is dependent on primary_key unit price

Last Answer : (A) Non key attribute V_name is dependent on V_no which is part of composite key

Description : A relation R={A,B,C,D,E,F,G} is given with following set of functional dependencies: F={AD→E, BE→F, B→C, AF→G} Which of the following is a candidate key? (A) A (B) AB (C) ABC (D) ABD

Last Answer : Answer: D

Description : Select the ‘False’ statement from the following statements about Normal Forms: (A) Lossless preserving decomposition into 3NF is always possible (B) Lossless preserving decomposition into BCNF is always possible (C) Any relation with two attributes is in BCNF (D) BCNF is stronger than 3NF

Last Answer : (B) Lossless preserving decomposition into BCNF is always possible

Description : In a relational database model, NULL values can be used for all but which one of the following? (A) To allow duplicate tuples in the table by filling the primary key column(s) with NULL. (B) To ... D) To fill a column in a tuple when that column does not really exist for that particular tuple.

Last Answer : (A) To allow duplicate tuples in the table by filling the primary key column(s) with NULL.

Description : Select operator is not a unary operator. ii) Project operator chooses subset of attributes or columns of a relation. A) i-True, ii-False B) i-True, ii-True C) i-False, ii-True D) i-False, ii-False

Last Answer : C) i-False, ii-True

Description : Consider the formula in image processing RD = 1 - (1/CR) Where CR = n1/n2 CR is called as compression ratio n1 and n2 denotes the number of information carrying units in two datasets that represent ... . (A) Data Compression (B) Data Redundancy (C) Data Relation (D) Data Representation

Last Answer : (B) Data Redundancy

Description : Let L be the language generated by regular expression 0*10* and accepted by the deterministic finite automata M. Consider the relation RM defined by M. As all states are reachable from the start state, RM has ................ equivalence classes. (A) 2 (B) 4 (C) 5 (D) 6

Last Answer : (D) 6

Description : Do employment agencies get paid by the hours the employee works?

Last Answer : Generally, recruiters get about 10-20% of the first year's salary for the employee.

Description : They pay a dividend to their employee and deposit the dividend in a for-profit interest-bearing bank. What is the ruling ? I work in an aluminum factory in Canada. At the end of each year ... ; Such as interest bank , alcohol hall , cigarettes , other things and other investments of interest banks.

Last Answer : Alhamdulillah. The portion that the company pays at the end of each year is a portion of the employee's remuneration and salary. Since this money is kept separately in a specific account for the employee ... part. Will try to determine the amount of haram part as much as possible. GOD is Omniscient.

Description : 1. What is the age of retirement of the Judges of the High Court? 2. In methane molecule how are the four hydrogen atoms arranged? 3. Which industry earns the second highest net foreign exchange ... the climate of India is? 20. Under which act was the Supreme Court in British India established?

Last Answer : CITES (Convention on International Trade in Endangered Species)

Description : Han earns $33.00 for babysitting 4 hours. At this rate, how much will he earn if he babysits for 7 hours?

Last Answer : 33.00 Divided by 4 is 8.258.25 is what she earns in 1 hour8.25 x 7 = 57.75Hope this helped

Description : A shopkeeper sells speaker at the rate of Rs 914each and earns the commission of 4%. He also sells phones at the rate of Rs 160each and earns a commission of 20%. How much amount of commission will he earn in two weeks if he sells 20 speaker and 12phones per day?

Last Answer : Sp of modem=Rs 914 Commission of one speaker =4*914/100 Commission of 20 speakers = 4*914*20/100=Rs 731.2 Commission of one phone = 20*160/100 Commission of 12 phones = 20*160*12/100=384 Total ... 384) = 1115.2 The amount of commission will he earn in 2 weeks = 1115.2*14= Rs 15,612.8

Description : What is better: One big SQL query or several?

Last Answer : It’s difficult without examples. But what you describe seems like a simple join.