News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

Mcq Answers for SQL Server

LAST_NAME  DEPARTMENT_ID     SALARY
ALLEN                10                      3000
MILLER              20                     1500
King                   20                      2200
Davis                 30                      5000

Which of the following Subqueries will execute without any error?

  1. SELECT distinct department_id FROM employees Where salary = (SELECT AVG(salary) FROM employees GROUP BY department_id);

  2. SELECT distinct department_id FROM employees Where salary > (SELECT AVG(salary) FROM employees GROUP BY department_id);

  3. SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id);

  4. SELECT distinct department_id FROM employees Where salary > ALL (SELECT AVG(salary) FROM employees GROUP BY department_id);

  5. SELECT distinct department_id FROM employees Where salary < (SELECT AVG(salary) FROM employees GROUP BY department_id);

Answer: Answer is c, d

STUDENT_ID        INT 
SEMESTER_END        DATETIME 
GPA                FLOAT 

Which of the following statements finds the highest Grade Point Average (GPA) per semester?

  1. SELECT MAX(gpa) FROM student_grades WHERE gpa IS NOT NULL

  2. SELECT (gpa) FROM student_grades GROUP BY semester_end WHERE gpa IS NOT NULL

  3. SELECT MAX(gpa) FROM student_grades WHERE gpa IS NOT NULL GROUP BY semester_end

  4. SELECT MAX(gpa) GROUP BY semester_end WHERE gpa IS NOT NULL FROM student_grades

  5. SELECT MAX(gpa) FROM student_grades GROUP BY semester_end WHERE gpa IS NOT NULL

Answer: Answer is c

Update OrderTable set OrderDiscount=OrderDiscount*1.10

  1. Increases OrderDiscount of first row by 10%

  2. Increases OrderDiscount of all rows by 10%

  3. Does nothing without where clause

  4. Gives an error due to lack of where clause

Answer: Answer is b

  1. Union

  2. Union all

  3. Intersect

  4. Minus

  5. Minus all

Answer: Answer is e
Further Reading:

Useful resources,Set Operations


  1. Where

  2. Order By

  3. Group By

  4. Having

  5. First Group By and then Having

  6. Like

  7. Between

Answer: Answer is b
Further Reading:

Useful resources,ORDER BY Clause


a)The FLOOR function returns the smallest integer greater or equal to the argument.

(b)The CEIL function gives the largest integer equal to or less that the argument.

  1. (a) is true

  2. (b) is true

  3. both (a) and (b) are true

  4. both (a) and (b) are false

Answer: Answer is d
Further Reading:

Useful resources, FLOOR, CEILING, Comparing CEILING and FLOOR


  1. True

  2. False

Answer: Answer is a

select empno, DISTINCT ename, Salary from emp;

  1. EMPNO, unique value of ENAME and then SALARY are displayed

  2. EMPNO, unique value ENAME and unique value of SALARY are displayed

  3. DISTINCT is not a valid keyword in SQL

  4. No values will be displayed because the statement will return an error

Answer: Answer is d

  1. select * from orders where sum(amount) > 20000

  2. select * from orders where sum(amount) > 20000 order by OrderDate

  3. select * from orders group by OrderDate having sum(amount)>20000

  4. select * from orders group by OrderDate where sum(amount) > 20000

Answer: Answer is c
Further Reading:

Useful resources, HAVING clause


  1. 1

  2. 2

  3. 3

  4. 4

  5. 5

  6. 6

  7. None of the above

Answer: Answer is g
Further Reading:

Useful resources, Maximum Capacity Specifications for SQL Server


Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;