MySQL Database Quiz Questions

Course Name:MySQL
Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:CONCAT
Current Quiz Count:30
Progress
0%
Q1
True / False

The CONCAT function in MySQL can only concatenate two strings at a time.

Q2
True / False

In MySQL, the CONCAT function returns NULL if any argument is NULL.

Q3
True / False

The CONCAT function in MySQL can be used to concatenate numerical values as well as strings.

Q4
True / False

In MySQL, the CONCAT function can be used to combine column values from different tables.

Q5
True / False

The CONCAT function in MySQL automatically adds spaces between concatenated strings.

Q6
True / False

Using CONCAT_WS in MySQL will produce the same result as CONCAT if the separator is an empty string.

Q7
True / False

MySQL’s CONCAT function can be used within a stored procedure to dynamically construct SQL queries.

Q8
True / False

The CONCAT function in MySQL is case-sensitive.

Q9
True / False

Using the CONCAT function with a large number of arguments in MySQL may lead to performance issues.

Q10
True / False

MySQL’s CONCAT function can be used to concatenate the results of a subquery.

Q11
Single Choice

Which MySQL function is used to combine two or more strings into a single string?

Q12
Single Choice

Given the SQL code: SELECT CONCAT('Hello', 'World');, what will be the output?

Q13
Single Choice

Which MySQL function would you use to concatenate the strings 'MySQL' and 'Database' with a space in between?

Q14
Single Choice

What will be the result of the following SQL query?

SQL Code
SELECT CONCAT('The price is ', 100, ' dollars.');
Q15
Single Choice

How can you concatenate the first name and last name of a user in a MySQL database, ensuring there's a space between them?

Q16
Single Choice

Which SQL statement correctly concatenates the strings 'MySQL', 'is', and 'fun' with a comma separating each word?

Q17
Single Choice

What will be the output of the following SQL statement if first_name is 'John' and last_name is NULL?

SQL Code
SELECT CONCAT(first_name, ' ', last_name) AS full_name FROM users;
Q18
Single Choice

How would you concatenate the first_name, last_name, and email fields of a user, using a pipe | character as a separator, and ensuring that NULL values are ignored?

Q19
Single Choice

Which of the following statements would correctly concatenate two fields, city and state, ensuring there is a hyphen '-' between them, even if one of the fields is NULL?

Q20
Single Choice

What does the query return if first_name is 'Alice', last_name is NULL, and email is 'alice@example.com'?

SQL Code
Consider the following SQL query:
SELECT CONCAT_WS(', ', first_name, last_name, email) AS contact_info
FROM employees
WHERE department_id = 3;
Q21
Multiple Choice

Which query correctly concatenates 'first_name' and 'last_name' from the 'employees' table with a space between them?

SQL Code
SELECT CONCAT(first_name, ' ', last_name) AS full_name
FROM employees;
Q22
Multiple Choice

Identify the correct SQL query that concatenates 'street', 'city', and 'state' from the 'addresses' table with commas separating the fields.

SQL Code
SELECT CONCAT(street, ', ', city, ', ', state) AS full_address
FROM addresses;
Q23
Multiple Choice

Which query correctly concatenates 'product_name' and 'category' from the 'products' table, separated by a hyphen?

SQL Code
SELECT CONCAT(product_name, '-', category) AS product_info
FROM products;
Q24
Multiple Choice

Determine the correct SQL query that concatenates 'first_name', 'middle_name', and 'last_name' from the 'students' table with spaces between each name.

SQL Code
SELECT CONCAT(first_name, ' ', middle_name, ' ', last_name) AS full_name
FROM students;
Q25
Multiple Choice

Which SQL query concatenates 'item_name' and 'brand' from the 'inventory' table, with a colon (:) separating them?

SQL Code
SELECT CONCAT(item_name, ':', brand) AS item_info
FROM inventory;
Q26
Multiple Choice

Which query correctly concatenates 'department_name' and 'location' from the 'departments' table with a dash (-) and a space separating them?

SQL Code
SELECT CONCAT(department_name, ' - ', location) AS dept_location
FROM departments;
Q27
Multiple Choice

Determine the correct SQL query that concatenates 'make', 'model', and 'year' from the 'vehicles' table, with a space between each field.

SQL Code
SELECT CONCAT(make, ' ', model, ' ', year) AS vehicle_info
FROM vehicles;
Q28
Multiple Choice

Which query correctly concatenates 'first_name', 'last_name', and 'email' from the 'users' table, separated by commas?

SQL Code
SELECT CONCAT(first_name, ',', last_name, ',', email) AS user_info
FROM users;
Q29
Multiple Choice

Identify the correct query that concatenates 'book_title' and 'author' from the 'books' table, with a space-dash-space separator.

SQL Code
SELECT CONCAT(book_title, ' - ', author) AS book_info
FROM books;
Q30
Multiple Choice

Which SQL query concatenates 'company_name', 'contact_person', and 'phone' from the 'clients' table, separated by slashes?

SQL Code
SELECT CONCAT(company_name, '/', contact_person, '/', phone) AS client_info
FROM clients;