0% found this document useful (0 votes)
4 views2 pages

SQL Operators Practice Sheet

The document is a practice sheet for SQL operators, detailing the use of IN, BETWEEN, IS/IS NOT, LIKE, UNION, and string concatenation. Each section includes an example query and a task for the reader to complete. The tasks involve querying employee and student data based on specified conditions.

Uploaded by

divyashree28k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

SQL Operators Practice Sheet

The document is a practice sheet for SQL operators, detailing the use of IN, BETWEEN, IS/IS NOT, LIKE, UNION, and string concatenation. Each section includes an example query and a task for the reader to complete. The tasks involve querying employee and student data based on specified conditions.

Uploaded by

divyashree28k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL Operators Practice Sheet

1. IN Operator

Use IN to match a value from a list.


Example:
SELECT name FROM employees WHERE department IN ('HR', 'IT');

Task:
Write a query to find employees from 'Sales' or 'Finance' departments.

2. BETWEEN Operator

BETWEEN checks if a value lies in a range (inclusive).


Example:
SELECT name FROM employees WHERE salary BETWEEN 40000 AND 60000;

Task:
Write a query to fetch employees hired between '2022-01-01' and '2023-01-01'.

3. IS and IS NOT Operators

Use IS NULL or IS NOT NULL to check for null values.


Example:
SELECT name FROM employees WHERE manager_id IS NULL;

Task:
Find employees who have a manager assigned.

4. LIKE Operator

LIKE helps with pattern matching using % and _.


Example:
SELECT name FROM students WHERE name LIKE 'A%';

Task:
Find all student names that end with 'a'.

5. UNION vs UNION ALL

UNION combines results and removes duplicates.


UNION ALL includes duplicates.

Task:
Write a query that lists all cities from two tables: domestic_customers and international_customers.

6. String Concatenation

Use || in Oracle/PostgreSQL, CONCAT() in MySQL, + in SQL Server.


SQL Operators Practice Sheet

Example (MySQL):
SELECT CONCAT(first_name, ' ', last_name) AS full_name FROM employees;

Task:
Display each employee like: 'Employee 101: Alice Rao'.

You might also like