# Module 7: MySQL Querying Data

MODULE OVERVIEW

This module introduces SQL querying techniques used to retrieve, filter, sort
and organise information stored in MySQL databases.



Learners will understand how to write SELECT queries, apply filtering conditions
and retrieve specific records based on business requirements.



The module covers SELECT FROM, ORDER BY, WHERE, SELECT DISTINCT, logical
operators, IN, NOT IN, BETWEEN, LIKE, LIMIT, IS NULL and table and column
aliases.



These concepts help learners work with database records efficiently and retrieve
relevant information for reporting, analysis and business operations.






WHAT WILL BE COVERED


7.1 SELECT FROM

 * Understanding the purpose of the SELECT FROM statement.

 * Exploring the basic syntax of SELECT queries.

 * Retrieving information from specified database tables.

 * Selecting individual columns from a table.

 * Understanding how query results are displayed.

 * Applying SELECT FROM to retrieve business records.


7.2 SELECT

 * Understanding how the SELECT statement retrieves data.

 * Selecting specific columns from database tables.

 * Retrieving all columns using the asterisk (*) operator.

 * Selecting multiple columns in a single query.

 * Understanding how to structure SQL queries.

 * Retrieving customer, employee, product and transaction information.


7.3 ORDER BY

 * Understanding the purpose of the ORDER BY clause.

 * Sorting query results in ascending order.

 * Sorting records in descending order.

 * Using ASC and DESC keywords.

 * Sorting results based on multiple columns.

 * Applying ORDER BY to organise business records such as dates, names and
   transaction amounts.


7.4 WHERE

 * Understanding the purpose of the WHERE clause.

 * Filtering records based on specified conditions.

 * Using comparison operators in SQL queries.

 * Applying conditions to numerical, text and date values.

 * Combining WHERE with SELECT statements.

 * Retrieving specific records based on business requirements.


7.5 SELECT DISTINCT

 * Understanding the purpose of SELECT DISTINCT.

 * Retrieving unique values from database columns.

 * Removing duplicate results from query output.

 * Applying DISTINCT to individual columns.

 * Using DISTINCT with multiple columns.

 * Identifying unique categories, locations and customer details.


7.6 AND

 * Understanding the purpose of the AND operator.

 * Combining multiple conditions within a WHERE clause.

 * Retrieving records that satisfy all specified conditions.

 * Using AND with comparison operators.

 * Applying multiple filtering conditions to database queries.


7.7 OR

 * Understanding the purpose of the OR operator.

 * Combining alternative conditions within a WHERE clause.

 * Retrieving records that satisfy at least one specified condition.

 * Using OR with comparison operators.

 * Combining AND and OR in SQL queries.

 * Applying alternative filtering conditions to retrieve relevant records.


7.8 IN

 * Understanding the purpose of the IN operator.

 * Checking whether a value matches any value in a specified list.

 * Using IN with the WHERE clause.

 * Filtering records based on multiple permitted values.

 * Applying IN to retrieve information for selected categories, locations or
   statuses.


7.9 NOT IN

 * Understanding the purpose of the NOT IN operator.

 * Excluding specified values from query results.

 * Using NOT IN with the WHERE clause.

 * Filtering records that do not match values in a given list.

 * Applying NOT IN to exclude selected categories or statuses from business
   reports.


7.10 BETWEEN

 * Understanding the purpose of the BETWEEN operator.

 * Filtering records within a specified range.

 * Applying BETWEEN to numerical values.

 * Using BETWEEN with date values.

 * Understanding inclusive range conditions.

 * Retrieving records within specified date periods, price ranges or quantity
   limits.


7.11 LIKE

 * Understanding the purpose of the LIKE operator.

 * Searching for records based on specified text patterns.

 * Using the percentage (%) wildcard.

 * Using the underscore (_) wildcard.

 * Searching for values that begin or end with specific characters.

 * Applying LIKE to search customer names, email addresses and other text-based
   information.


7.12 LIMIT

 * Understanding the purpose of the LIMIT clause.

 * Restricting the number of records returned by a query.

 * Retrieving a specified number of rows.

 * Using LIMIT with SELECT statements.

 * Understanding how LIMIT works with ORDER BY.

 * Retrieving selected records for summaries and reports.


7.13 IS NULL

 * Understanding the concept of NULL values in MySQL.

 * Identifying records where column values are NULL.

 * Using IS NULL in WHERE conditions.

 * Understanding the difference between NULL and an empty value.

 * Exploring IS NOT NULL for retrieving records with available values.

 * Applying NULL checks to identify incomplete or missing business information.


7.14 TABLE AND COLUMN ALIASES

 * Understanding the purpose of aliases in SQL queries.

 * Assigning temporary names to table columns.

 * Using the AS keyword to define column aliases.

 * Creating aliases for table names.

 * Improving query readability using meaningful aliases.

 * Applying table aliases when writing queries involving multiple tables.

 * Using aliases to present clearer column headings in reports.


SKILLS YOU WILL GAIN

 * Writing SQL queries to retrieve information from MySQL databases.

 * Selecting specific columns and retrieving complete table records.

 * Sorting query results using ORDER BY.

 * Filtering records using WHERE conditions.

 * Retrieving unique values using SELECT DISTINCT.

 * Combining conditions using AND and OR.

 * Filtering records using IN, NOT IN and BETWEEN.

 * Searching text values using LIKE and wildcards.

 * Limiting query results using LIMIT.

 * Identifying missing values using IS NULL.

 * Improving query readability using table and column aliases.

 * Developing SQL queries to support business reporting and data retrieval.


LEARNING OUTCOMES

By the end of this module, learners will be able to:

 * Retrieve relevant business information from MySQL databases using structured
   SELECT queries.

 * Filter customer, employee, product and transaction records based on specific
   business conditions.

 * Sort records by dates, names, quantities and transaction values to support
   reporting requirements.

 * Identify unique categories, locations and other distinct business values.

 * Combine multiple filtering conditions to retrieve records that meet defined
   business requirements.

 * Search for specific information using text patterns and wildcard operators.

 * Retrieve records within specified date periods and numerical ranges.

 * Limit query results when preparing focused summaries and reports.

 * Identify missing or incomplete information using NULL conditions.

 * Use meaningful table and column aliases to improve SQL query readability and
   report presentation.

 * Develop SQL queries that support operational reporting, data analysis and
   business decision-making.


CERTIFICATION ALIGNMENT

This module develops MySQL querying and data retrieval knowledge that supports
the broader learning pathway towards the Oracle Certified Professional, MySQL
5.6 Database Administrator certification referenced in the course brochure.

The topics covered help learners understand SQL statements, filtering
conditions, sorting, pattern matching and data retrieval techniques within MySQL
databases.


CONTINUE TO THE NEXT MODULE

Continue to Module 8: MySQL Joins
[https://teamacademy.help.center/article/1370-module-8-mysql-joins] to learn how
to retrieve related information from multiple database tables using INNER JOIN,
LEFT JOIN, RIGHT JOIN, SELF JOIN, OUTER JOIN and CROSS JOIN.