Question: You have a table "engineers" with the following table structure:
enggid int(4)
name varchar(50)
salary int(4)
You want to select the top 2 engineers in the decreasing order of their salaries, starting with the maximum salary. Which of the following SQL queries will fetch this data?
A
SELECT TOP 2 * FROM engineers ORDER BY max(salary) DESC
B
SELECT TOP 2 * FROM engineers ORDER BY salary DESC, GROUP BY salary
C
SELECT TOP 2 * FROM engineers GROUP BY salary DESC
D
SELECT TOP 2 * FROM engineers ORDER BY salary DESC
E
SELECT TOP 2 [name], salary FROM engineers ORDER BY salary DESC
Question: SQL SERVER 2005 provides a new feature to enable partitioning of the data in the database. But only those database objects can be partitioned which store data in the database. In accordance with the above statement, which of the following database objects can be partitioned?
Question: You have a table named 'employees', having the following structure.
empid int(4)
deptname varchar(50)
salary int(4)
And a view is created as follows:
create view viemployees as select * from employees
You want to insert a new row into the table having the following values:
empid=1010, deptname=HR, salary=10000.
Which of the following are the correct insert SQL queries?
A
insert into employees values (1010, HR, 10000)
B
insert into employees values (1010, 'HR', 10000)
C
insert into viemployees values (1010, 'HR', 10000)
D
insert into viemployees (empid, deptname, salary) values (1010, HR, 10000)
E
insert into employees (empid, deptname, salary) set values (1010, 'HR', 10000)
Question: Examine the data in the EMPLOYEES table given below:
LAST_NAME DEPARTMENT_ID SALARY
Allen 10 3000
Miller 20 1500
King 20 2200
Davis 30 5000
Which of the following sub-queries work?
A
SELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY department_id)
B
SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY department_id)
C
SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id)
D
SELECT department_id FROM employees WHERE SALARY > ALL (SELECT AVG(salary) FROM employees GROUP BY department_id)
E
SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM employees GROUP BY AVG(SALARY))