This is the fourth article in a series of learning the CREATE VIEW SQL statement. So far, we have done a great deal of creating and altering views using T-SQL. In this last part, I want to take a big look at how to work with indexed views.
Read more »SQL commands
How to drop temp tables in SQL Server
March 23, 2020Temporary tables, also known as temp tables, are widely used by the database administrators and developers. However, it may be necessary to drop the temp table before creating it. It is a common practice to check whether the temporary table exists or not exists. So, we can eliminate the “There is already an object named ‘#temptablename’ in the database” error during the temporary table creation.
Read more »An overview of the sp_WhoIsActive stored procedure
March 23, 2020This article gives a comprehensive overview of custom stored procedure sp_whoisactive.
Read more »Learn SQL: SQL Triggers
March 20, 2020SQL Triggers are another powerful database object we have at our disposal. In previous articles, we’ve covered user-defined functions, user-defined procedures, and SQL Views. Today we’ll talk about SQL triggers and how to use them to achieve the desired behavior.
Read more »SQL Server MAX() aggregate function
March 19, 2020SQL Server provides us with several aggregate functions that can be used to perform different types of calculations on a set of values, and return a single value that summarized the input data set. These SQL Server aggregate functions include AVG(), COUNT(), SUM(), MIN() and MAX().
Read more »SQL Server TOP clause overview and examples
March 19, 2020This article explores the SQL Server TOP clause using various examples, along the way, we will also run through performance optimization while using the TOP clause in SQL Server.
Read more »CREATE VIEW SQL: Inserting data through views in SQL Server
March 16, 2020This is the third article in a series of learning the CREATE VIEW SQL statement. So far, I’d say that we’re comfortable and familiar with the syntax, and we’ve learned how to create and modify views. In this part, we’ll continue to work on views using the sample database and data that we created so far.
Read more »Learn SQL: SQL Views
March 11, 2020SQL views are another powerful database object we have at our disposal. In the previous two articles of this series, we’ve talked about user-defined functions and user-defined procedures and showed simple examples of how to use them. Today, we’ll do the same for the SQL views.
Read more »A comprehensive guide to the SQL Format function
March 11, 2020This article explains the usage of SQL Format function and performance comparison with SQL CONVERT.
Read more »SQL Server SESSION_CONTEXT() function with examples
March 9, 2020This article explores the SQL Server session context function, SESSION_CONTEXT() and performs its comparison with the function, CONTEXT_INFO().
Read more »Learn SQL: User-Defined Stored Procedures
March 5, 2020Stored procedures (SPs) are one more powerful database object we have at our disposal. They can help us handle many tasks and improve performance and security. Today, we’ll take a look at simple SPs and show, on examples, how to use them.
Read more »CREATE VIEW SQL: Modifying views in SQL Server
March 5, 2020In my previous article, we looked at how to use the CREATE VIEW SQL statement to create views. In this one, we are moving on and focusing on how to modify views. We will continue using examples on a sample database and data created in the first write-up so in order to follow along, head over and read the Creating views in SQL Server part before starting with this one.
Read more »How to use database backups to recover data after SQL Delete and SQL Truncate statements
March 4, 2020This article explores the recovery of data removed by SQL Delete and SQL Truncate statements using SQL database backups.
Read more »Overview of the T-SQL If Exists statement in a SQL Server database
March 3, 2020This article walks through different versions of the T-SQL IF EXISTS statement for the SQL database using various examples.
Read more »SQL AVG() function introduction and examples
March 2, 2020In this article, we will learn the SQL Average function which is known as AVG() function in T-SQL. AVG() function is an aggregate function that calculates the average value of a numerical dataset that returns from the SELECT statement.
Read more »Learn SQL: User-Defined Functions
February 25, 2020You can create several user-defined objects in a database. One of these is definitely user-defined functions. When used as intended, they are a very powerful tool in databases. In today’s article, we’ll see how to create, change and remove them from the database, as well as how to use them. So, let’s dive into the matter.
Read more »SQL CROSS JOIN with examples
February 24, 2020In this article, we will learn the SQL CROSS JOIN concept and support our learnings with straightforward examples, which are explained with illustrations.
Read more »Learn SQL: Set Theory
February 21, 2020The set theory is very important in order to understand data and databases. While you could live without it and still be a good SQL developer, understanding it will surely help a lot. So, let’s dive into the matter.
Read more »The PARSEONLY SQL command overview and examples
February 21, 2020This article explores the uses of the SET PARSEONLY SQL command for SQL Server queries.
Read more »The internals of SQL Truncate and SQL Delete statements
February 21, 2020This article gives you an insight into the SQL Truncate and SQL Delete commands behavior.
Read more »Learn SQL: SQL Data Types
February 14, 2020What are SQL data types, why do we need them, and how to use them? Today, we’ll try to answer these questions by giving an overview of some most common data types used in SQL Server.
Read more »What is a foreign key in SQL Server
February 13, 2020In this article, we will seek an answer to an important question – “What is a foreign key in SQL Server?”. At the same time, we will give some seconder answers to this question. In this way, we can understand the foreign key concept more clearly.
Read more »SQL AS keyword overview and examples
February 11, 2020SQL AS keyword is used to give an alias to table or column names in the queries. In this way, we can increase the readability and understandability of the query and column headings in the result set.
Read more »Learn SQL: The INFORMATION_SCHEMA Database
February 7, 2020The best way how to explain what the INFORMATION_SCHEMA database is would be – “This is the database about databases. It’s used to store details of other databases on the server”. What does that mean, how we can use it, and what we can do with this data is the topic of today’s article.
Read more »Learn SQL: How to Write a Complex SELECT Query
February 4, 2020In my career, I’ve heard many times, things like “How to write a complex SELECT query?”, “Where to start from?” or “This query looks so complex. How you’ve learned to write such complex queries?”. While I would like to think of myself as of a brilliant mind or genius or add something like “query magician” to my social network profiles, well, writing complex SQL wouldn’t be the only thing required to do that. Therefore, in this article, I’ll try to cover the “magic” behind writing complex SELECT statements.
Read more »