AdventureWorks Database: Retrieve individuals using multiple conditions
SQL Query - AdventureWorks: Exercise-44 with Solution
44. Create a SQL query to retrieve individuals from the following table with a businessentityid inside 1500, a lastname starting with 'Al', and a firstname starting with 'M'.
Sample table: Person.Person
Sample Solution:
SELECT businessentityid, firstname,LastName
FROM person.person
WHERE businessentityid <= 1500 AND LastName LIKE '%Al%' AND FirstName LIKE '%M%';
Sample Output:
businessentityid|firstname|lastname | ----------------+---------+---------+ 327|Milton |Albury | 335|Michelle |Alexander| 341|Marvin |Allen | 343|Michael |Allen | 1149|Mary |Alexander|
SQL AdventureWorks Editor:
Practice Online
Contribute your code and comments through Disqus.
Previous: Retrieve individuals using multiple conditions.
Next: Using a derived table with multiple values.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
SQL: Tips of the Day
What's the difference between VARCHAR and CHAR?
VARCHAR is variable-length.
CHAR is fixed length.
If your content is a fixed size, you'll get better performance with CHAR.
Ref: https://bit.ly/3wl3ram
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook