Search Header Logo

DB QUIZ 1

Authored by AMMAR NAZAR

Other

University

Used 2+ times

 DB QUIZ 1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which of the following queries will correctly select all rows where the "age" column is between 20 and 30, inclusive, and sorted by "name" in descending order?

SELECT * FROM users WHERE age >= 20 OR age <= 30 ORDER BY name DESC;

SELECT * FROM users WHERE age BETWEEN 20 AND 30 ORDER BY name DESC;

SELECT * FROM users WHERE age >= 20 AND age <= 30 ORDER BY name ASC;

SELECT * FROM users WHERE age BETWEEN 20 AND 30 ORDER BY name ASC;

2.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the output of the following query if the "salary" column contains NULL values?

SELECT COUNT(salary) FROM employees;

Count of all rows including NULLs

Count of all rows excluding NULLs

Count of only NULL values

Syntax error

3.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which SQL query will delete only the first 10 rows from a table "orders" with 1000 rows?

DELETE FROM orders LIMIT 10;

TRUNCATE orders LIMIT 10;

DELETE TOP 10 FROM orders;

REMOVE FROM orders LIMIT 10;

4.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

8. What does the following query do?

SELECT * FROM users WHERE name LIKE 'A%' AND age > 30 OR city = 'New York';

A. Returns users whose name starts with 'A' and age > 30 and live in New York

B. Returns users whose name starts with 'A' and age > 30 or live in New York

C. Returns only users from New York

D. Syntax error

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

13. What does this query return?

SELECT * FROM orders WHERE product_name LIKE '%phone%';

Orders containing 'phone' anywhere in the product name

Orders where the product name starts with 'phone'

Orders where the product name ends with 'phone'

Syntax error

6.

FILL IN THE BLANK QUESTION

45 sec • 1 pt

Retrieve all employees who are either in the 'Sales' department or have a salary above 50,000 but exclude those whose names start with 'A' and who are not in 'HR':

7.

FILL IN THE BLANK QUESTION

45 sec • 1 pt

Select the top 3 highest paid employees, including those with NULL salaries, but order NULLs last:

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?