MENU

Fun & Interesting

Excel VBA Introduction Part 58.5 - SQL for Excel Files - Adding Criteria to a Query

WiseOwlTutorials 9,042 4 years ago
Video Not Working? Fix It Now

Writing SQL for Excel with ADODB playlist https://youtube.com/playlist?list=PLNIs-AWhQzckUd5i0E1xeSFeBAonYIurK VBA Working with Databases playlist https://youtube.com/playlist?list=PLNIs-AWhQzclbRVLCZlsFvpz6fz2nPGbt Get files here https://www.wiseowl.co.uk/vba-macros/videos/vba-ado-net-recordsets/sql-excel-criteria/ If you'd like to help fund Wise Owl's conversion of tea and biscuits into quality training videos, you can click this link https://www.wiseowl.co.uk/donate?t=1​ to make a donation. Thanks for watching! This video explains how to add the Where clause to your SQL query to extract only the rows you want from an Excel file. You'll learn about the basics of adding criteria to the Where clause, including how to write basic logical tests and the range of available comparison operators. You'll also learn how to enter numbers, text and date values in your conditions, including the best date format to use. You'll learn how to combine conditions using the And and Or operators, and how to reverse the logic using the Not operator, including how to ensure multiple conditions are evaluated in the correct order by using brackets. You'll see how to use the special Like operator with wildcard characters for working with text columns. You'll also learn how to use the special In and Between operators to shorten longer criteria and make your SQL code more succinct. Finally, you'll learn how to use the Is Null and Is Not Null operators to find or ignore rows with missing values. Chapters 00:00:00 Topic List 00:01:08 The Basic Setup 00:04:00 The Where Clause, Logical Tests and Comparison Operators 00:06:12 Writing a Simple Where Condition 00:07:14 Using Other Comparison Operators 00:10:32 A Note on Exclamation Operators 00:11:32 Writing Criteria without Column Headers 00:13:53 Comparing One Field with Another 00:15:20 Comparing Columns to Find Mistakes 00:16:17 Calculations in Criteria 00:20:20 Writing Text in Criteria 00:24:00 Text and Case Sensitivity 00:24:49 Text with Other Comparison Operators 00:27:51 The Like Operator 00:30:01 Some Basic Wildcard Patterns 00:32:00 Using Not Like 00:33:30 Writing Dates in Criteria 00:37:59 Using Different Date Formats 00:41:42 Dates with Other Comparison Operators 00:42:55 Dates with Time Values 00:47:50 Combining Conditions with the And Operator 00:52:00 Logical Tests and Round Brackets 00:52:50 Writing Multiple Conditions using Expressions 00:55:00 Combining Conditions with the Or Operator 00:57:09 Adding Multiple Conditions 00:58:26 Using Round Brackets to Group Conditions 01:01:00 Grouping Many Conditions 01:03:55 Using the In Operator with Numbers 01:06:19 Using the In Operator with Text 01:07:21 Using the In Operator with Dates 01:08:39 Using Not In 01:09:14 The Between Operator and Dates 01:12:10 Using Not Between 01:12:38 The Between Operator and Numbers 01:13:33 The Between Operator and Text 01:15:40 The Is Null and Is Not Null Operators 01:19:37 Null Text and Date Fields 01:20:59 What's Next? Visit www.wiseowl.co.uk for more online training resources in Microsoft Excel, Power BI, DAX, SQL Server, Reporting Services, Analysis Services, Integration Services, ASP.NET, C#, Visual Basic, Microsoft Access and more

Comment