Search Header Logo

Break the Query Round-1

Authored by HARIHARAN 20ITA13

Computers

University

Used 1+ times

Break the Query Round-1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Write the SQL query to get the third maximum salary of an employee from a table named employees.

SELECT * FROM(

SELECT employee_name, salary, DENSE_RANK() 

OVER(ORDER BY salary DESC)r FROM Employee) 

WHERE r=3;

SELECT * FROM(

SELECT employee_name, salary, DENSE_RANK() 

OVER(ORDER BY salary ASC)r FROM Employee) 

WHERE r=5;

SELECT * FROM(

SELECT employee, salary, DENSE_RANK() 

OVER(GROUP BY salary )a FROM Employee) 

WHERE r=2;

None of these

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

If the SQL table has duplicate rows, the duplicate rows must be removed.

Let’s assume the following table as our dataset:

DELETE table WHERE ID IN (SELECT ID, COUNT(ID) FROM   table ORDER BY  ID HAVING COUNT (ID) > 5); 

REMOVE FROM table where ID IN (SELECT ID, COUNT(ID) FROM   table BY  ID HAVING COUNT (ID) > 1); 

DELETE FROM table WHERE ID IN (SELECT ID, COUNT(ID) FROM   table GROUP BY  ID HAVING COUNT (ID) > 1); 

None of these

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Syntax for SQL CAST function

CAST(expression TO [data type])

CAST(expression AS [data type])

CAST(expression IN [data type])

CAST(expression FOR [data type])

4.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What are the operators available in SQL?

Arithmetic Operators

Relational Operator

Logical

Operations

Comparison

Operators

5.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

The ways to get the count of records in a table?

SELECT * FROM table1

SELECT COUNT(*) FROM table1

None of these

SELECT rows FROM

sysindexes

WHERE id =

OBJECT_ID(table1) AND indid

< 2

6.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Write a SQL query to find the names of employees that begin with ‘A’?

Consider Table name and column name are emp_details and EmpName

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider a table named "employees" with columns "id", "name", "department", and "salary". Write a SQL query to display the names of employees who earn more than the average salary.

SELECT emp_name FROM employee WHERE salary > (SELECT AVG(salary) FROM employees);

SELECT emp_name FROM employee WHERE salary > (SELECT AVG(salary) FROM employees);

All of these

SELECT name FROM employee WHERE salary < (SELECT AVG(salary) FROM employee);

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?