What are SQL Views? Views are virtual tables in SQL. A view, like every other table in the database, has rows and columns. We can create a view by selecting fields from one or more tables in the database. A View can contain all of the rows of a table or particular rows based on […]
April 7, 2023 | DBMS | No comments
SQL set operations combine the output of two or more SELECT statements into a single result set. The set operators appear to be similar to SQL joins, but there is a significant difference. SQL joins combine the columns from different tables, whereas SQL operators combine rows from different queries. Types of Set Operation: Union Union […]
April 6, 2023 | DBMS | No comments
What is an Alias? An SQL alias is simply an alternative name that can be used to refer to a table or column within a SQL query. This is especially useful for large or complex queries. Alias is primarily used to provide a short alias name for a complexly named column or table. The AS […]
April 3, 2023 | DBMS | No comments
In the previous section we saw Aggregate Functions, in this section let us discuss Scalar Functions. Scalar Function: A scalar function is a type of function that returns a single value based on the input parameters. In SQL queries, scalar functions can manipulate data, perform calculations, and retrieve specific values from a database. Following are […]
April 3, 2023 | DBMS | No comments
What are SQL Functions? SQL functions are predefined routines that can be invoked by SQL queries to perform specific operations on database data. These functions are used to manipulate data and return results based on the parameters passed to them. SQL functions are categorized into the following two categories: Aggregate Functions Scalar Functions Aggregate Functions: […]
April 3, 2023 | DBMS | No comments
What is the SQL DISTINCT keyword? The SQL DISTINCT keyword is used in conjunction with the SELECT statement to remove all duplicate records and only return unique records. DISTINCT can also be used in conjunction with aggregate SQL functions such as COUNT, MAX, SUM, AVG, and so on. DISTINCT operates not only on a single […]
March 29, 2023 | DBMS | No comments
The HAVING clause in SQL Server includes one or more conditions that must be TRUE for groups of records. It’s similar to the GROUP BY clause’s WHERE clause. The only distinction is that the WHERE clause cannot be used with aggregate functions, whereas the HAVING clause can. The HAVING clause is always followed by the […]
March 28, 2023 | DBMS | No comments
The SQL Group By statement is used to organize similar data into groups. The data is further organized using an equivalent function. It means that if multiple rows in a specific column have the same values, they will be grouped. The SELECT statement is combined with the GROUP BY clause in a SQL query: The […]
March 28, 2023 | DBMS | No comments
What is the ORDER BY Clause? In the SELECT query, the ORDER BY clause can be used to sort the result in ascending or descending order of one or more columns. ORDER BY by default sorts the data in ascending order. We can sort the data in descending order with the keyword DESC and ascending […]
March 26, 2023 | DBMS | No comments
In SQL to filter data based on a specific pattern, the LIKE clause is used in the WHERE condition. It can be applied to date, string, or numeric values. However, using the string values is advised. Uses of LIKE clause in SQL: The following are some examples of how the LIKE clause is used: Enables […]
March 25, 2023 | DBMS | No comments