SQL-SET2 NEW
Quiz
•
Computers
•
Professional Development
•
Practice Problem
•
Hard
V PERUMAL
Used 11+ times
FREE Resource
Enhance your content in a minute
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
NACOS Kahoot Session II
Quiz
•
University
15 questions
JDBC_Objective_Exam_2
Quiz
•
Professional Development
15 questions
7ICT - Algorithms Revision Quiz
Quiz
•
7th Grade
20 questions
Online Platform Block Q
Quiz
•
11th - 12th Grade
15 questions
Chapter 3: Storage devices and media (Part 2):
Quiz
•
10th - 11th Grade
20 questions
City & Guilds Award in Business Processes
Quiz
•
12th Grade
21 questions
CPA MS-Office Hotkeys Quiz
Quiz
•
8th Grade - Professio...
16 questions
Algo Quiz
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Computers
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
