
Count rows with select count(*) from a table and compare total rows to filtered results with a where clause, naming the count column with an alias.
Discover how to use the sum function to total salaries, group results by department, and join employee and department data for meaningful payroll insights.
Learn how to concatenate first and last names in SQL, using plus signs and spaces, alias the result as name, and cast numbers to text when combining fields.
Learn how to use the case statement in SQL to label six-figure salaries, select first name, last name, and salary, and populate a notes field with conditional notes.
Learn how a left join combines all employees with their departments, returning matching department data where available and including all employee records.
Explore the difference between left join and inner join in SQL by linking the employees and department tables with primary and foreign keys, showing matches and unmatched left rows.
Learn how to filter records using the IN operator in SQL, selecting departments 3 or 4 from the employee table and handling text with single quotes.
Learn to use the between keyword to define a range, such as salary between 98 and 110, for clearer and more concise SQL queries.
Examine how the or operator differs from and in SQL Server, using datepart to extract years, filtering employees by department or hire year, and understanding when or expands results.
Sort customer data with order by using ordinals or field names to group by state and city, then order by name, and learn ordinals, default ascending, and common pitfalls.
This video will discuss the importance of being familiar with ASCII values and how htis ties in with the ORDER BY Clause.
You really need to watch this video along with the next video, about COLATION to get the entire message.
This video will discuss the importance of being familiar with "COLATION" and how this ties in with the ORDER BY Clause.
You really need to watch this video along with the previous video, about ASCII values to get the entire message.
In this video we continue on with a strange ordering request: "Put NY first, then all other states in order." This video shows a specific approach that works but is more complicated than what is necessary.
Apply the sum function to a query, add a sum field, show total dollar amount and record counts, and order customer names by the sum field in descending order.
Explore how to use group by with the having clause to filter aggregated results, such as showing customers who spent over $2000 or exceeded sales counts.
GROUP BY - HAVING CLAUSE - Part 2
Master group by and having to sum the total field and filter customers with total greater than or equal to 2000, and compare having with group by and order by.
xxx
VIDEO - The video will show you how to write to a text file from SQL Server.
The following notes are references to the additional support files that are connected with this section. These files are downloadable so that you can copy and paste the code right into SSMS / T-SQL.
01 - CREATE PROCEDURE Write To File - This is the TSQL code to create your own [WriteToFile] STORED PROCEDURE.*
02 - Write To Text File - Command Line SQL - This is an example of how to EXECUTE the [WriteToFile] STORED PROCEDURE.*
03 - Write To Text File Command Line SQL - With Parameters - This is an example of how to EXECUTE the [WriteToFile] STORED PROCEDURE - with Parameters/Variables/Arguments.*
04 - Write To Text File Command Line SQL - With Parameters And Date In Filename - This is an example of how to execute the [WriteToFile] STORED PROCEDURE - with Parameters/Variables/Arguments and INSERTING a FORMATTED DATE-TIME STAMP into the file name.*
Ole Automation SQL - This is the code that you will need to run to initially turn on the OLE AUTOMATION Permissions in SQL SERVER.*
* This T-SQL code can be copied into the SSMS command line environment.
VIDEO- The video will show you how to make use of a User Defined Function. In this particular example the function will return a value that has been formatted with n instances of a specific text character.
The following notes are references to the additional support files that are connected with this section. These files are downloadable so that you can copy and paste the code right into SSMS / T-SQL.
01 - CREATE FUNCTION – dbo.PrePad() Example- This is the TSQL code to create your own dbo.[PrePad]USER DEFINED FUNCTION.*
02 – USER DEFINED FUNCTION – dbo.PrePad() Example- This is an example of how toCALL / USE the dbo.[PrePad]USER DEFINED FUNCTION.*
* This T-SQL code can be copied into the SSMS command line environment.
Learn to use a user defined function in a real-world sql example, including scalar valued functions, owner qualification, and a prepared function that pads order numbers to six digits.
This is an in depth course about using and programming with SQL Server. It assumes that the student has at least a rudimentary understanding of database concepts and architecture and gets right into the meat of the subject.
This course will get you up to speed on executing queries. The final part of the course briefly touches on stored procedures and user defined functions.