Overall SQL Exam

Overall SQL Exam

Professional Development

30 Qs

quiz-placeholder

Similar activities

SGS - I AM SOLITAIRE

SGS - I AM SOLITAIRE

Professional Development

30 Qs

Koodomobile - Choose Happy

Koodomobile - Choose Happy

Professional Development

31 Qs

Shelf life

Shelf life

Professional Development

29 Qs

Ivy-Predictive Modeling using Python Assessment

Ivy-Predictive Modeling using Python Assessment

Professional Development

29 Qs

OMTQM Midterm Exam (30 POINTS)

OMTQM Midterm Exam (30 POINTS)

Professional Development

26 Qs

Refreshment Forsa 16.03.2021

Refreshment Forsa 16.03.2021

Professional Development

26 Qs

Microsoft Word Quiz

Microsoft Word Quiz

Professional Development

26 Qs

OnTime Brands - Quiz 2

OnTime Brands - Quiz 2

Professional Development

29 Qs

Overall SQL Exam

Overall SQL Exam

Assessment

Passage

Professional Development

Professional Development

Practice Problem

Hard

Created by

Data_Analyst_Harish undefined

Used 5+ times

FREE Resource

AI

Enhance your content in a minute

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

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which query fetches all customers whose name starts with “A”?

SELECT * FROM customers WHERE name = 'A%';

SELECT * FROM customers WHERE name LIKE 'A%';

SELECT * FROM customers WHERE name STARTS WITH 'A';

SELECT * FROM customers WHERE name IN ('A%');

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of the following is TRUE about PRIMARY KEY? (Select all that applies)

Allows NULL values

Must be unique

A table can have multiple PRIMARY KEYS

A values must be entered in a PRIMARY KEY Column

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which query finds the 2nd highest salary?

SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees);

SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 1;

SELECT salary FROM employees ORDER BY salary DESC LIMIT 2,1;

Both a and b

4.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which query finds each employee’s salary compared to previous employee in order of hire_date?

SELECT name, salary,

LAG(salary) OVER(ORDER BY hire_date) prev_salary

FROM employees;

SELECT name, salary,

LEAD(salary) OVER(ORDER BY hire_date) prev_salary

FROM employees;

SELECT name, salary FROM employees ORDER BY hire_date;

SELECT name, salary, salary-1 FROM employees;

5.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of the following queries creates a VIEW of active customers?

CREATE VIEW active_customers AS

SELECT * FROM customers WHERE status='active';

CREATE OR REPLACE VIEW active_customers AS

SELECT * FROM customers WHERE status='active';

CREATE TABLE active_customers AS

SELECT * FROM customers WHERE status='active';

Both a and b

6.

MULTIPLE SELECT QUESTION

45 sec • 2 pts

Which query finds employees who do not have a manager assigned? (Select all that applies)

SELECT * FROM employees WHERE manager_id IS NULL;

SELECT * FROM employees WHERE manager_id = NULL;

SELECT * FROM employees WHERE manager_id NOT IN (SELECT id FROM employees);

SELECT * FROM employees WHERE manager_id = 0;

7.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which query checks employees working in more than one department? (emp_dept table)

SELECT emp_id FROM emp_dept

GROUP BY emp_id

HAVING COUNT(DISTINCT dept_id) > 1;

SELECT emp_id FROM emp_dept WHERE dept_id > 1;

SELECT DISTINCT emp_id FROM emp_dept;

SELECT emp_id FROM emp_dept GROUP BY dept_id;

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?

Discover more resources for Professional Development