In this video we’ll walk you though how to select top rows within a query. We’ll show you how to retrieve the top or bottom rows in the result. We’ll also show you how to use one sort to select the rows, and once completed, another sort to present them (tricky). For instance you […]
Continue readingThe main purpose of a CASE expression is to return a value based on one or more conditional tests. CASE expressions can be used anywhere in a SQL statement an expression is allowed. Though a truly an expression, some people refer to them as “CASE statements.” This most likely stems from that use of the […]
Continue readingThis is the second in a series of articles about subqueries. In this article we discuss subqueries in the SELECT statement’s column list. Other articles discuss their uses in other clauses. All the examples for this lesson are based on Microsoft SQL Server Management Studio and the AdventureWorks2012 database. You can get started using these […]
Continue readingThe purpose of this article is to introduce you to subqueries and some of their high-level concepts. There are a lot of details to cover in order to learn sub queries, but you’ll see we cover those in depth in later articles. All the examples for this lesson are based on Microsoft SQL Server Management […]
Continue readingIn this article learn when to use WHERE and HAVING. Both perform similar functions, but for different purposes! All the examples for this article are based on Microsoft SQL Server Management Studio and the AdventureWorks2012 database. You can get started using these free tools using my Guide Getting Started Using SQL Server. How do Where and Having Differ? […]
Continue readingHow to use the Except Operator The EXCEPT operator is used to exclude like rows that are found in one query but not another. It returns rows that are unique to one result. To use the EXCEPT operator, both queries must return the same number of columns and those columns must be of compatible […]
Continue readingHow to use the Intersect Operator The INTERSECT operator is used to combine like rows from two queries. It returns rows that are in common between both results. To use the INTERSECT operator, both queries must return the same number of columns and those columns must be of compatible data types. Note: All the […]
Continue readingCombine Table Rows Using UNION In this lesson we are going to talk about the UNION clause. You can use the UNION clause to combine table rows from two different queries into one result. Unlike a join, which combines columns from different tables, a union combines rows from different tables. Here is an illustration of […]
Continue readingLearn to use Union, Intersect, and Except Clauses The UNION, INTERSECT, and EXCEPT clauses are used to combine or exclude like rows from two or more tables. They are useful when you need to combine the results from separate queries into one single result. They differ from a join in that entire rows are matched […]
Continue readingIn today’s lesson you’re going to learn about grouping results returned from your queries using the GROUP BY clause. The objectives of today’s lesson are to: Learn to how to group results using GROUP BY Use aggregate functions to perform calculations Understand how to filter groups using the HAVING clause GROUP BY Clause The […]
Continue readingIn today’s lesson you’re going to learn about grouping results returned from your queries using the GROUP BY clause. The objectives of today’s lesson are to: Learn how to group results using GROUP BY Use aggregate functions to perform calculations Understand how to filter groups using the HAVING clause Important! Please follow along and do the […]
Continue readingIn this lesson you are going to explore how to do pattern matching with the SQL Where clause LIKE operator. Using this phrase allows us perform partial matches of data values and obtain answers to questions which can’t be done with conventional comparisons. The lesson’s objectives are to: learn about the like clause understand wild cards […]
Continue readingIn this lesson you are going to explore how to use pattern matching in SQL with the LIKE operator. Using this phrase allows us perform partial matches of data values and obtain answers to questions which can’t be done with conventional comparisons. The lesson’s objectives are to: learn about the LIKE match condition understand wild cards Important! Please follow […]
Continue readingIn today’s lesson you’re going to learn how to query results using the WHERE clause. The objectives of today’s lesson are to: Learn to use more than one compare condition at a time using Boolean logic Comprehensive example with Select, Where, and Order By Using Multiple Conditions to Query Results In previous lesson’s we learned how […]
Continue readingIn today’s lesson you’re going to learn more about filtering results returned from your queries using the WHERE clause. The objectives of today’s lesson are to: Learn to use more than one compare condition at a time using Boolean logic Comprehensive example with Select, Where, and Order By Important! Please follow along and do the examples […]
Continue readingIn today’s lesson you’re going to learn how filter the results returned from your queries using the WHERE clause. This clause is important as only those records matching the where clause’s conditions are returned in the query results. The objectives of today’s lesson are to: Learn about various condition types, such as Equality, Range, and […]
Continue readingIn today’s lesson you’re going to learn how to filter query results using the WHERE clause. This clause is important as only those records matching the where clause’s conditions are returned in the query results. The objectives of today’s lesson are to: Learn about various condition types, such as Equality, Range, and Membership Comprehensive example […]
Continue readingIn this lesson you are going to explore how to sort your query results by using SQL’s ORDER BY statement. Using this phrase allows us to sort our result in ascending or descending order. In addition you can limit your query to a specified number of results. The lesson’s objectives are to: learn how to […]
Continue readingIn this series of lessons you’re going to learn how to query Microsoft SQL Server using the SQL SELECT statement. Once you have read this lesson you’ll be able to: Identify all the tables in a SQL Server Database Using SSMS (SQL Server Management Studio). Understand how to list a table’s columns. Use the SQL SELECT statement to view […]
Continue readingIn this series of lessons you’re going to learn how to query the sample database using the SQL Select statement. Once you have read this blog and viewed the series of videos you’ll be able to: Identify all the tables in a SQLite database. Understand how to list a table’s columns. Use the SQL Select statement […]
Continue reading