Microsoft SQL Server Database Quiz Questions

Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:LIKE Operator
Current Quiz Count:45
Progress
0%
Q1
True / False

The `LIKE` operator is used to search for a specified pattern in a column.

Q2
True / False

The `LIKE` operator can use the wildcard character `%` to represent zero or more characters.

Q3
True / False

The `LIKE` operator is case-insensitive by default in Microsoft SQL Server.

Q4
True / False

The `_` wildcard character in the `LIKE` operator represents a single character.

Q5
True / False

You can use the `LIKE` operator to search for a pattern at the beginning of a string only.

Q6
True / False

The `LIKE` operator can be used in combination with the `NOT` keyword to find rows that do not match a pattern.

Q7
True / False

The `LIKE` operator can use both `%` and `_` wildcards in the same pattern.

Q8
True / False

The `LIKE` operator can be used with numeric columns to search for patterns.

Q9
True / False

Using `LIKE 'A%'` will match any string that starts with the letter 'A'.

Q10
True / False

The `LIKE` operator can be used to match patterns that contain special characters.

Q11
True / False

The `LIKE` operator is the best choice for exact matches in SQL Server.

Q12
True / False

Using `LIKE '%Smith'` will find all records that end with 'Smith'.

Q13
True / False

The `LIKE` operator is case-sensitive in Microsoft SQL Server by default.

Q14
True / False

Using `LIKE 'John_'` will find all records that start with 'John' followed by one more character.

Q15
True / False

The `LIKE` operator can be used with a combination of wildcards and specific characters.

Q16
Single Choice

Which query would you use to find all names that start with 'A'?

SQL Code
SELECT *
FROM Employees
WHERE Name LIKE 'A%';
Q17
Single Choice

How would you find all customers whose name contains 'John'?

SQL Code
SELECT CustomerID, CustomerName
FROM Customers
WHERE CustomerName LIKE '%John%';
Q18
Single Choice

Which query finds all products that end with 'X'?

SQL Code
SELECT ProductID, ProductName
FROM Products
WHERE ProductName LIKE '%X';
Q19
Single Choice

How would you find all records where the City starts with 'New'?

SQL Code
SELECT City, Country
FROM Locations
WHERE City LIKE 'New%';
Q20
Single Choice

Which query finds all email addresses that contain 'gmail'?

SQL Code
SELECT Email
FROM Users
WHERE Email LIKE '%gmail%';
Q21
Single Choice

Which query would find all orders placed in February?

SQL Code
SELECT OrderID, OrderDate
FROM Orders
WHERE OrderDate LIKE '2024-02-%';
Q22
Single Choice

How would you find all usernames that start with 'admin'?

SQL Code
SELECT Username
FROM Users
WHERE Username LIKE 'admin%';
Q23
Single Choice

Which query would find all comments that contain 'error'?

SQL Code
SELECT Comment
FROM Feedback
WHERE Comment LIKE '%error%';
Q24
Single Choice

How would you find all phone numbers that end with '1234'?

SQL Code
SELECT PhoneNumber
FROM Contacts
WHERE PhoneNumber LIKE '%1234';
Q25
Single Choice

Which query finds all addresses that contain the word 'Street'?

SQL Code
SELECT Address
FROM Locations
WHERE Address LIKE '%Street%';
Q26
Single Choice

How would you find all product codes that start with 'AB'?

SQL Code
SELECT ProductCode
FROM Products
WHERE ProductCode LIKE 'AB%';
Q27
Single Choice

Which query finds all email addresses that end with 'yahoo.com'?

SQL Code
SELECT Email
FROM Users
WHERE Email LIKE '%@yahoo.com';
Q28
Single Choice

How would you find all records where the Company name contains 'Tech'?

SQL Code
SELECT CompanyName
FROM Companies
WHERE CompanyName LIKE '%Tech%';
Q29
Single Choice

Which query would find all last names that start with 'S' and end with 'n'?

SQL Code
SELECT LastName
FROM Employees
WHERE LastName LIKE 'S%n';
Q30
Single Choice

How would you find all records where the state starts with 'CA'?

SQL Code
SELECT State
FROM Locations
WHERE State LIKE 'CA%';
Q31
Multiple Choice

Which queries find all first names that contain 'Ann'?

SQL Code
SELECT FirstName
FROM People
WHERE FirstName LIKE '%Ann%';
Q32
Multiple Choice

Which queries find all usernames that end with '123'?

SQL Code
SELECT Username
FROM Accounts
WHERE Username LIKE '%123';
Q33
Multiple Choice

How would you find all email addresses that contain 'example'?

SQL Code
SELECT Email
FROM Users
WHERE Email LIKE '%example%';
Q34
Multiple Choice

Which queries find all product names that start with 'Pro'?

SQL Code
SELECT ProductName
FROM Inventory
WHERE ProductName LIKE 'Pro%';
Q35
Multiple Choice

How would you find all comments that contain 'urgent'?

SQL Code
SELECT Comment
FROM Notes
WHERE Comment LIKE '%urgent%';
Q36
Multiple Choice

Which queries find all order numbers that start with 'ORD'?

SQL Code
SELECT OrderNumber
FROM Orders
WHERE OrderNumber LIKE 'ORD%';
Q37
Multiple Choice

How would you find all records where the country name contains 'United'?

SQL Code
SELECT Country
FROM Locations
WHERE Country LIKE '%United%';
Q38
Multiple Choice

Which queries find all department names that end with 'Dept'?

SQL Code
SELECT DepartmentName
FROM Departments
WHERE DepartmentName LIKE '%Dept';
Q39
Multiple Choice

How would you find all student IDs that start with 'S' and end with '5'?

SQL Code
SELECT StudentID
FROM Students
WHERE StudentID LIKE 'S%5';
Q40
Multiple Choice

Which queries find all book titles that contain the word 'Guide'?

SQL Code
SELECT Title
FROM Books
WHERE Title LIKE '%Guide%';
Q41
Multiple Choice

How would you find all records where the first name ends with 'n'?

SQL Code
SELECT FirstName
FROM Contacts
WHERE FirstName LIKE '%n';
Q42
Multiple Choice

Which queries find all cities that start with 'San'?

SQL Code
SELECT City
FROM Locations
WHERE City LIKE 'San%';
Q43
Multiple Choice

How would you find all employees where the last name contains 'son'?

SQL Code
SELECT LastName
FROM Employees
WHERE LastName LIKE '%son%';
Q44
Multiple Choice

Which queries find all countries where the name starts with 'Can'?

SQL Code
SELECT CountryName
FROM Countries
WHERE CountryName LIKE 'Can%';
Q45
Multiple Choice

How would you find all phone numbers that contain '555'?

SQL Code
SELECT PhoneNumber
FROM Directory
WHERE PhoneNumber LIKE '%555%';