What are SQL Where and Like Statements Basics? (Part 3 of 8)...

What are SQL Where and Like Statements Basics? (Part 3 of 8)...  

Phillip Photo
Phillip
2 months
0 Views
Want to watch this again later?
Sign in to add this video to a playlist. Login
0 0
Category:
Description:
▶ C'mon over to https://realpars.com where you can learn PLC programming faster and easier than you ever thought possible!

=============================

▶ Check out the full blog post over at https://realpars.com/sql-where

=============================

If you are just now joining along with this series of videos, please note that you are going to learn about SQL programming basics.

If you would like to follow along with us, please review the RealPars video, “How to install MySQL and import a sample database”, on how to download and setup MySQL database on your computer.
(https://realpars.com/mysql/)

“What are SQL Where and Like statements basics” continues where we left off within the “What are SQL programming basics” video for our series of lessons covering SQL programming.
(https://realpars.com/sql/)

In this video, you will learn more about relational databases and about the language of SQL.

In subsequent lessons we will apply what we have learned in these videos, to view a sample database and program a few SQL queries to read and write to the database that will provide specific organized data.

The “Where” clause is optional and specifies which data values or rows will be returned or displayed, based on the criteria described after the keyword “Where”.
- Equal
- Greater than
- Less than
- Greater than or equal to
- Less than or equal to
- Not equal to
- Like

First, we need to get familiar with “Where” and “Like” clauses.
The “LIKE” clause is a very powerful operator that allows you to select only rows that are "like" what you specify.

The percent sign can be used as a wild card to match any possible character that might appear before or after the characters specified.

We start writing the SQL statement in the SQL Query Tab to find any first names that start with the letter J.
Note that the strings must be in single quotes.
---------------------------------------------------------
SELECT FirstName, LastName, City
FROM realparsmodel.students;
WHERE FirstName LIKE 'J%';
---------------------------------------------------------

We run the statement by pressing the Execute Query button to view the results in the Output Panel.
The results display only first names beginning with the letter J.

We can specify another SQL statement to find the students’ first names that end in the letter N. As you can see, we changed the LIKE operator to compare names ending in the letter N.
The results display only first names ending with the letter N.

Once again we use MySQL Workbench to write the new statement, looking for only records with the first name Jean. This query would then only select rows where the first name equals “Jean” exactly.

We can specify another SQL statement to identify students with student numbers less than 120. The results display only records with the student numbers less than 120.

Now a department asks us to write a statement to select only students’ last names containing the letter U.
To create this query, we used the wildcard character, percent sign, before and after the letter U.
The results display only the Last Name, First Name and Credit Limit columns and records with last names that include the letter U.

This concludes the video, “What are SQL Where and Like statements basics”. By now you should be getting accustomed to simple SQL statements and ready for the next lesson in SQL.

Our series of subsequent videos to follow will consist of the following lessons, be sure to watch for these videos offering prerequisite learning for the beginner and then unto the more advanced statements of SQL learning.

=============================

Review the MySQL minimum hardware requirement web page here: https://forums.mysql.com/read.php?11 ,629199,629211

Download the MySQL Installer: https://dev.mysql.com/downloads/installer/

Download the sample database SQL file from here: https://realpars.com/wp-content/uploads/2019/12/realparssampledatabasev2.zip

=============================

Missed our most recent videos? Watch them here:
https://realpars.com/differential-pressure-transmitter
https://realpars.com/sql/
https://realpars.com/as-interface/

=============================

To stay up to date with our last videos and more lessons, make sure to subscribe to this YouTube channel:
http://goo.gl/Y6DRiN

=============================

TWEET THIS VIDEO https://ctt.ac/jTX8M

=============================

Follow us on Facebook https://www.facebook.com/therealpars/

Follow us on Twitter https://twitter.com/realpars

Follow us on LinkedIn https://www.linkedin.com/company/realpars

Follow us on Instagram https://www.instagram.com/realparsdotcom/

#RealPars #SQL #MySQL

Comments:

Comment
Up Next Autoplay