Q1
True / FalseThe CONCAT function can concatenate multiple string values in SQL Server.
SQL Code
SELECT CONCAT('Hello', ' ', 'World');
SELECT CONCAT('Good', ' ', 'Morning');
SELECT CONCAT('SQL', ' ', 'Server');
SELECT CONCAT('Database', ' ', 'Management');
The CONCAT function can combine multiple string values into one.
Q2
True / FalseThe CONCAT function requires at least three arguments.
SQL Code
SELECT CONCAT('Hello', 'World');
SELECT CONCAT('123', '456');
SELECT CONCAT('abc', 'def');
SELECT CONCAT('foo', 'bar');
The CONCAT function can take two or more string arguments.
Q3
True / FalseCONCAT can be used to concatenate NULL values without resulting in a NULL output.
SQL Code
SELECT CONCAT('Hello', NULL, 'World');
SELECT CONCAT('Good', NULL, 'Morning');
SELECT CONCAT('SQL', NULL, 'Server');
SELECT CONCAT('Database', NULL, 'Management');
The CONCAT function ignores NULL values and concatenates the non-NULL values.
Q4
True / FalseUsing CONCAT with an integer will result in an error.
SQL Code
SELECT CONCAT('The number is ', 123);
SELECT CONCAT('Value: ', 456);
SELECT CONCAT('ID: ', 789);
SELECT CONCAT('Code: ', 101112);
The CONCAT function can convert non-string values (like integers) to strings and concatenate them.
Q5
True / FalseThe CONCAT function can concatenate columns of different data types.
SQL Code
SELECT CONCAT(first_name, ' ', age) FROM users;
SELECT CONCAT(last_name, ' ', salary) FROM employees;
SELECT CONCAT(product_name, ' ', price) FROM products;
SELECT CONCAT(department_name, ' ', budget) FROM departments;
The CONCAT function can handle and concatenate columns of different data types, converting them to strings.
Q6
True / FalseThe CONCAT function is case-sensitive.
SQL Code
SELECT CONCAT('hello', 'WORLD');
SELECT CONCAT('GOOD', 'morning');
SELECT CONCAT('sql', 'SERVER');
SELECT CONCAT('database', 'MANAGEMENT');
The CONCAT function itself is not case-sensitive, but the output will preserve the case of the input strings.
Q7
True / FalseCONCAT can be used in the SELECT clause to create a full name from first_name and last_name columns.
SQL Code
SELECT CONCAT(first_name, ' ', last_name) AS full_name
FROM employees;
SELECT CONCAT(first_name, ' ', middle_name, ' ', last_name) AS full_name
FROM employees;
The CONCAT function can combine first_name and last_name columns to create a full name.
Q8
True / FalseCONCAT cannot be used to concatenate more than two columns.
SQL Code
SELECT CONCAT(first_name, ' ', middle_name, ' ', last_name)
FROM employees;
SELECT CONCAT(title, ' - ', description)
FROM products;
SELECT CONCAT(city, ', ', state, ' ', zip)
FROM addresses;
SELECT CONCAT(make, ' ', model, ' (', year, ')')
FROM vehicles;
The CONCAT function can concatenate multiple columns, not limited to just two.
Q9
True / FalseThe CONCAT function can be used with the WHERE clause.
SQL Code
SELECT * FROM users
WHERE CONCAT(first_name, ' ', last_name) = 'John Doe';
SELECT * FROM customers
WHERE CONCAT(city, ', ', state) = 'New York, NY';
SELECT * FROM products
WHERE CONCAT(title, ' - ', category) = 'Widget - Tools';
SELECT * FROM orders
WHERE CONCAT(order_id, '-', customer_id) = '123-456';
The CONCAT function can be used in the WHERE clause to concatenate columns and match against a value.
Q10
True / FalseThe CONCAT function can handle both strings and numbers without explicit conversion.
SQL Code
SELECT CONCAT('Age: ', age) FROM users;
SELECT CONCAT('Order #: ', order_id) FROM orders;
SELECT CONCAT('Price: $', price) FROM products;
SELECT CONCAT('Stock: ', quantity) FROM inventory;
The CONCAT function implicitly converts numbers to strings when concatenating.
Q11
True / FalseUsing CONCAT with NULL values will always result in NULL.
SQL Code
SELECT CONCAT('Value is ', NULL);
SELECT CONCAT('Name: ', NULL);
SELECT CONCAT('Date: ', NULL);
SELECT CONCAT('Status: ', NULL);
The CONCAT function will ignore NULL values and concatenate non-NULL values.
Q12
True / FalseYou cannot use CONCAT to combine text and date values.
SQL Code
SELECT CONCAT('Date: ', order_date) FROM orders;
SELECT CONCAT('Delivery: ', delivery_date) FROM shipments;
SELECT CONCAT('Birthday: ', birth_date) FROM users;
SELECT CONCAT('Event Date: ', event_date) FROM events;
The CONCAT function can combine text and date values, converting the date to a string format.
Q13
True / FalseThe result of CONCAT('A', 'B', 'C') is 'ABC'.
SQL Code
SELECT CONCAT('A', 'B', 'C');
SELECT CONCAT('1', '2', '3');
SELECT CONCAT('X', 'Y', 'Z');
SELECT CONCAT('!', '@', '#');
The CONCAT function will combine all the arguments into a single string 'ABC'.
Q14
True / FalseThe CONCAT function can be used within a CASE statement.
SQL Code
SELECT CASE
WHEN condition THEN CONCAT('Value: ', value)
ELSE 'No Value'
END
FROM table;
The CONCAT function can be used inside a CASE statement to conditionally concatenate values.
Q15
True / FalseCONCAT_WS is a variation of CONCAT that allows specifying a separator.
SQL Code
SELECT CONCAT_WS('-', 'A', 'B', 'C');
SELECT CONCAT_WS(',', '1', '2', '3');
SELECT CONCAT_WS(';', 'X', 'Y', 'Z');
SELECT CONCAT_WS(' ', 'Hello', 'World');
The CONCAT_WS function allows specifying a separator to use between the concatenated values.
Q18
Single ChoiceHow do you use CONCAT to format a full address from street, city, and state columns?
SQL Code
SELECT CONCAT(street, ', ', city, ', ', state) AS full_address
FROM addresses;
SELECT CONCAT(city, ', ', state, ' ', zip) AS full_address
FROM addresses;
The CONCAT function combines street, city, and state columns to form a full address.
Q21
Single ChoiceHow do you use CONCAT to combine the first_name, middle_name, and last_name columns with spaces in between?
SQL Code
SELECT CONCAT(first_name, ' ', middle_name, ' ', last_name) AS full_name
FROM employees;
SELECT CONCAT(first_name, middle_name, last_name) AS full_name
FROM employees;
The CONCAT function can combine multiple columns with specified separators.
Q25
Single ChoiceHow do you use CONCAT to create a customer's full address as 'Address: <street>, <city>, <state> <zip>'?
SQL Code
SELECT CONCAT('Address: ', street, ', ', city, ', ', state, ' ', zip) AS full_address
FROM customers;
SELECT CONCAT(street, ', ', city, ', ', state, ' ', zip) AS full_address
FROM customers;
The CONCAT function can format a string to include multiple column values with specified separators.
Q28
Single ChoiceHow do you use CONCAT to create a greeting as 'Hello, <first_name>!'?
SQL Code
SELECT CONCAT('Hello, ', first_name, '!') AS greeting
FROM users;
SELECT CONCAT('Hi, ', first_name, '!') AS greeting
FROM users;
The CONCAT function can be used to concatenate a string with a first name and a punctuation mark.
Q29
Single ChoiceHow do you use CONCAT to format an employee's ID and name as 'ID: <employee_id> - Name: <first_name> <last_name>'?
SQL Code
SELECT CONCAT('ID: ', employee_id, ' - Name: ', first_name, ' ', last_name) AS employee_info
FROM employees;
SELECT CONCAT('Employee: ', first_name, ' ', last_name) AS employee_info
FROM employees;
The CONCAT function can be used to format a string with an employee's ID and full name.
Q30
Single ChoiceHow do you use CONCAT to create a label for an inventory item as 'Item: <item_name> - Stock: <quantity>'?
SQL Code
SELECT CONCAT('Item: ', item_name, ' - Stock: ', quantity) AS inventory_label
FROM inventory;
SELECT CONCAT('Product: ', item_name, ' - Quantity: ', quantity) AS inventory_label
FROM inventory;
The CONCAT function can be used to format a string with an item name and its stock quantity.
Q31
Single ChoiceHow do you use CONCAT to create a formatted string as 'Course: <course_name> - Duration: <duration> hours'?
SQL Code
SELECT CONCAT('Course: ', course_name, ' - Duration: ', duration, ' hours') AS course_info
FROM courses;
SELECT CONCAT('Program: ', course_name, ' - Length: ', duration, ' hrs') AS course_info
FROM courses;
The CONCAT function can be used to format a string with a course name and its duration.
Q32
Single ChoiceHow do you use CONCAT to format a date as 'Day: <day> - Month: <month> - Year: <year>'?
SQL Code
SELECT CONCAT('Day: ', DAY(order_date), ' - Month: ', MONTH(order_date), ' - Year: ', YEAR(order_date)) AS formatted_date
FROM orders;
SELECT CONCAT('Order Date: ', order_date) AS formatted_date
FROM orders;
The CONCAT function can be used to format a date string with specified components.
Q33
Single ChoiceHow do you use CONCAT to display a department's name and code as 'Dept: <department_name> (Code: <department_code>)'?
SQL Code
SELECT CONCAT('Dept: ', department_name, ' (Code: ', department_code, ')') AS department_info
FROM departments;
SELECT CONCAT('Department: ', department_name, ' - Code: ', department_code) AS department_info
FROM departments;
The CONCAT function can be used to format a string with a department name and code.
Q34
Single ChoiceHow do you use CONCAT to create a product label as 'Product: <product_name> - Category: <category>'?
SQL Code
SELECT CONCAT('Product: ', product_name, ' - Category: ', category) AS product_info
FROM products;
SELECT CONCAT('Item: ', product_name, ' - Category: ', category) AS product_info
FROM products;
The CONCAT function can be used to format a string with a product name and its category.
Q35
Single ChoiceHow do you use CONCAT to display a book's title and author as 'Title: <book_title> - Author: <author_name>'?
SQL Code
SELECT CONCAT('Title: ', book_title, ' - Author: ', author_name) AS book_info
FROM books;
SELECT CONCAT('Book: ', book_title, ' - Writer: ', author_name) AS book_info
FROM books;
The CONCAT function can be used to format a string with a book title and its author's name.
Q36
Single ChoiceHow do you use CONCAT to display a movie's title and director as 'Movie: <movie_title> - Director: <director_name>'?
SQL Code
SELECT CONCAT('Movie: ', movie_title, ' - Director: ', director_name) AS movie_info
FROM movies;
SELECT CONCAT('Film: ', movie_title, ' - Directed by: ', director_name) AS movie_info
FROM movies;
The CONCAT function can be used to format a string with a movie title and its director's name.
Q37
Single ChoiceHow do you use CONCAT to create a formatted string as 'Date: <day>/<month>/<year>'?
SQL Code
SELECT CONCAT('Date: ', DAY(order_date), '/', MONTH(order_date), '/', YEAR(order_date)) AS formatted_date
FROM orders;
SELECT CONCAT('Order Date: ', order_date) AS formatted_date
FROM orders;
The CONCAT function can be used to format a date string with specified components.
Q38
Single ChoiceHow do you use CONCAT to display a car's make and model as 'Car: <make> <model>'?
SQL Code
SELECT CONCAT('Car: ', make, ' ', model) AS car_info
FROM cars;
SELECT CONCAT('Vehicle: ', make, ' ', model) AS car_info
FROM cars;
The CONCAT function can be used to format a string with a car's make and model.
Q39
Single ChoiceHow do you use CONCAT to format an order number and date as 'Order #: <order_number> - Date: <order_date>'?
SQL Code
SELECT CONCAT('Order #: ', order_number, ' - Date: ', order_date) AS order_info
FROM orders;
SELECT CONCAT('Order: ', order_number, ' - Date: ', order_date) AS order_info
FROM orders;
The CONCAT function can be used to format a string with an order number and its date.
Q40
Single ChoiceHow do you use CONCAT to create a formatted string as 'Task: <task_name> - Due: <due_date>'?
SQL Code
SELECT CONCAT('Task: ', task_name, ' - Due: ', due_date) AS task_info
FROM tasks;
SELECT CONCAT('Task: ', task_name, ' - Deadline: ', due_date) AS task_info
FROM tasks;
The CONCAT function can be used to format a string with a task name and its due date.
Q41
Single ChoiceHow do you use CONCAT to format a movie title and release year as 'Title: <movie_title> (Year: <release_year>)'?
SQL Code
SELECT CONCAT('Title: ', movie_title, ' (Year: ', release_year, ')') AS movie_info
FROM movies;
SELECT CONCAT('Film: ', movie_title, ' - Released: ', release_year) AS movie_info
FROM movies;
The CONCAT function can be used to format a string with a movie title and its release year.
Q42
Single ChoiceHow do you use CONCAT to create a formatted string as 'Event: <event_name> - Date: <event_date>'?
SQL Code
SELECT CONCAT('Event: ', event_name, ' - Date: ', event_date) AS event_info
FROM events;
SELECT CONCAT('Activity: ', event_name, ' - Date: ', event_date) AS event_info
FROM events;
The CONCAT function can be used to format a string with an event name and its date.
Q43
Single ChoiceHow do you use CONCAT to display a person's name and age as 'Name: <first_name> <last_name> - Age: <age>'?
SQL Code
SELECT CONCAT('Name: ', first_name, ' ', last_name, ' - Age: ', age) AS person_info
FROM people;
SELECT CONCAT('Person: ', first_name, ' ', last_name, ' - Age: ', age) AS person_info
FROM people;
The CONCAT function can be used to format a string with a person's name and age.
Q44
Single ChoiceHow do you use CONCAT to create a formatted string as 'Title: <book_title> by <author_name>'?
SQL Code
SELECT CONCAT('Title: ', book_title, ' by ', author_name) AS book_info
FROM books;
SELECT CONCAT('Book: ', book_title, ' - Author: ', author_name) AS book_info
FROM books;
The CONCAT function can be used to format a string with a book title and its author's name.
Q45
Single ChoiceHow do you use CONCAT to display a company's name and location as 'Company: <company_name> - Location: <location>'?
SQL Code
SELECT CONCAT('Company: ', company_name, ' - Location: ', location) AS company_info
FROM companies;
SELECT CONCAT('Organization: ', company_name, ' - Location: ', location) AS company_info
FROM companies;
The CONCAT function can be used to format a string with a company name and its location.