SQL-SET2 NEW

SQL-SET2 NEW

Professional Development

20 Qs

quiz-placeholder

Similar activities

معالجة الصور المتقدمة

معالجة الصور المتقدمة

10th Grade

20 Qs

Common Protocols

Common Protocols

10th - 12th Grade

15 Qs

Đường lên đỉnh Olympia- Vòng Khởi Động

Đường lên đỉnh Olympia- Vòng Khởi Động

5th - 6th Grade

20 Qs

N+ Chapter 5

N+ Chapter 5

12th Grade

20 Qs

Spreadsheet Fundamentals - Quiz2

Spreadsheet Fundamentals - Quiz2

University

20 Qs

Coding Karel 2

Coding Karel 2

KG - University

20 Qs

Ms Word & Paint Quiz

Ms Word & Paint Quiz

4th Grade

20 Qs

Skill Competition Quiz 2024

Skill Competition Quiz 2024

10th Grade - University

20 Qs

SQL-SET2 NEW

SQL-SET2 NEW

Assessment

Quiz

Computers

Professional Development

Practice Problem

Hard

Created by

V PERUMAL

Used 11+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

There are many ways to fetch first 5 characters of the string.

In the following options, which command is used to fetch first 5 characters of the string?

1. Select SUBSTRING(StudentName,1,5) as studentname from student

2. Select RIGHT(Studentname,5) as studentname from student

option 1 only

option 2 only

both the options are correct

both the options are incorrect

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Write an SQL query to fetch the no. of workers for each department in the descending order.

SELECT DEPARTMENT, count(WORKER_ID) No_Of_ Workers FROM worker GROUP BY DEPARTMENT SORT BY No_Of_Workers DESC;

SELECT DEPARTMENT, count(DEPART_ID) No_Of_Depart,count(WORKER_ID) No_Of_Workers GROUP BY DEPARTMENT SORT BY No_Of_Workers DESC;

SELECT DEPARTMENT, count(WORKER_ID) No_Of_Workers FROM worker GROUP BY DEPARTMENT ORDER BY No_Of_Workers DESC

SELECT DEPARTMENT, count(DEPART_ID) No_Of_Depart,count(WORKER_ID) No_Of_Workers,FROM worker GROUP BY DEPARTMENT SORT BY No_Of_Workers DESC;

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Assume a schema of Emp ( Id, Name, DeptId ) , Dept ( Id, Name).

If there are 10 records in the Emp table and 5 records in the Dept table, how many rows will be displayed in the result of the following

SQL query: Select * From Emp, Dept

The query will result in 25 rows as a “cartesian product” or “cross join”

The query will result in 35 rows as a “cartesian product” or “cross join”

The query will result in 15 rows as a “cartesian product” or “cross join”

The query will result in 50 rows as a “cartesian product” or “cross join”

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Write a SQL query to find the 10th highest employee salary from an Employee table.

SELECT TOP (1) Salary FROM ( SELECT DISTINCT TOP (10) Salary FROM Employee ORDER BY Salary DESC ) AS Emp ORDER BY Salary

SELECT DISTINCT TOP (10) Salary FROM Employee ORDER BY Salary DESC AS Emp ORDER BY Salary

SELECT TOP (10) Salary FROM ( SELECT DISTINCT TOP (1) Salary FROM Employee ORDER BY Salary DESC ) AS Emp ORDER BY Salary

ELECT DISTINCT TOP (10) Salary FROM Employee ORDER BY Salary ASC AS Emp ORDER BY Salary

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How to find a duplicate records with one field?

SELECT name, COUNT(email) FROM users GROUP BY email HAVING COUNT(email) > 1

SELECT name, email, COUNT(*) FROM users GROUP BY name, email HAVING COUNT(*) >1

SELECT name, email, COUNT(*) FROM users GROUP BY name, email HAVING COUNT(*) =1

SELECT name, COUNT(email) FROM users GROUP BY email HAVING COUNT(email) < 1

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Write an SQL query to fetch all the employees who either live in California or work under a manager with ManagerId – 321.

SELECT EmpId, City, ManagerId FROM EmployeeDetails WHERE City='California' AND ManagerId='321';

SELECT EmpId, City, ManagerId FROM EmployeeDetails WHERE City=California OR ManagerId='321';

SELECT EmpId, City, ManagerId FROM EmployeeDetails WHERE City='California' OR ManagerId='321';

SELECT EmpId, City, ManagerId FROM EmployeeDetails WHERE City='California' AND ManagerId=321;

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Write an SQL query to update the employee names by removing leading and trailing spaces.

UPDATE EmployeeDetails SET FullName = RTRIM(LTRIM(FullName));

UPDATE EmployeeDetails SET FullName = LTRIM(RTRIM(FullName));

UPDATE EmployeeDetails SET FullName = RTRIM(FullName);

UPDATE EmployeeDetails SET FullName <>LTRIM(RTRIM(FullName));

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?