Articles

2,279 Articles

Subqueries

Last Updated On : Saturday, May 23, 2015As mentioned, a subquery can return different forms of results. It can return a single value, multiple values, or even an entire table result. SELECT productid, productname, unitprice FROM Production.Products WHERE unitprice = (SELECT MIN(unitprice) FROM Production.Products);

Multi-Join Queries

Last Updated On : Saturday, May 23, 2015As an example, suppose that you wanted to return all suppliers from Japan, and matching products where relevant. For this, you need an outer join between Production.Suppliers and Production.Products, preserving Suppliers. But you also want to include product category information, so you add an inner join to Production.Categories, […]

Few examples

Last Updated On : Thursday, May 17, 2018Beside select satement there are other commonly used query where exists or not exists (use subquery with it). Few examples are as follow. SELECT custid, companyname¬† FROM Sales.Customers AS C WHERE EXISTS (SELECT * FROM Sales.Orders AS O WHERE O.custid = C.custid AND O.orderdate = ‘20070212’); you can […]

Creating an AlwaysOn Endpoint

Last Updated On : Wednesday, May 27, 2015Unless you are using a domain-based account for each SQL Server service, you must create a mirroring endpoint prior to creating an AlwaysOn Availability Group. If you are using a domain-based account for all SQL Server services that will participate in the availability group, the Database Engine can […]

Configuring Readable Secondary Replicas

Last Updated On : Wednesday, May 27, 2015Readable secondary replicas can service read-only requests for database access, which enables you to offload read-only workloads from the primary replica. You can configure a secondary replica to be readable from the Availability Group Properties dialog box, as shown in Figure 8-19. There are three options when configuring […]