Skip to main content

Posts

Showing posts with the label SQL

Configure Database Mail – Send Email From SQL Database

The process of SQL Server Database Mail configuration has three main steps i.e. Create a Database Mail account Create a Database Mail profile Configure those two to work together How to send Email from Trigger in SQL Server?   Enabling Database Mail USE MASTER GO SP_CONFIGURE 'show advanced options' , 1 RECONFIGURE WITH OVERRIDE GO SP_CONFIGURE 'Database Mail XPs' , 1 RECONFIGURE WITH OVERRIDE GO SP_CONFIGURE 'show advanced options' , 0 RECONFIGURE WITH OVERRIDE GO   Mail Account Setup EXEC msdb . dbo . sysmail_add_account_sp     @account_name = 'Test'    , @description = 'Send emails using SQL Server Stored Procedure'    , @email_address = 'anil.singh581@gmail.com'    , @display_name = 'Test'    , @replyto_address = NULL    , @mailserver_name = 'smtp.gmail.com'    , @username = 'anil.singh@gmail.com'    , @password = '...

Most Popular Technologies of 2019 - Programming, Scripting, and Markup Languages

Most Popular Technologies of 2019 - Programming, Scripting, and Markup Languages 1.       JavaScript - 69.7% 2.       HTML/CSS - 63.1% 3.       SQL - 56.5% 4.       Python - 39.4% 5.       Java - 39.2% 6.       Bash/Shell/PowerShell - 37.9% 7.       C# - 31.9% 8.       PHP - 25.8% 9.       TypeScript - 23.5% 10. C++ - 20.4% 11. C - 17.3% 12. Ruby - 8.9% 13. Go - 8.8% 14. Swift - 6.8% 15. Kotlin - 6.6% 16. R - 5.6% 17. VBA - 5.5% 18. Objective-C 5.2% 19. Assembly - 5.0% 20. Scala - 4.2% 21. Rust - 3.0% 22. Dart - 1.8% 23. Elixir - 1.6% 24. Clojure - 1.5% 25. WebAssembly - 1.1% Most Popular Web Frameworks of 2019 :- 1.       jQuery - 48.3% 2.    ...

SQL WHERE AND, OR, NOT Clause [SQL Operators]

The SQL “ NOT ” clause is used with “ WHERE ” conditions. The “ AND ”, “ OR ” and “ NOT ” operators are used to test two or more conditions in a SELECT , INSERT , UPDATE , or DELETE statements. The “ WHERE” clause with “ AND” operator requires that two conditions are true and an “ OR ” requires that one of two conditions is true and the “ NOT” negates the specified condition. Stayed Informed   -   37 Best SQL Server Interview Questions and Answers Syntax:- --THE WHERE WITH AND OPERATOR SELECT ColumnName, ColumnName FROM TableName WHERE Condition1 AND Condition2 --THE WHERE WITH OR OPERATOR UPDATE TableName SET ColumnName = value WHERE Condition1 OR Condition2 --THE WHERE WITH NOT OPERATOR DELETE TableName WHERE NOT Condition1 Examples:- --SELECT ALL COUNTRIES SELECT [Id] ,[CountryName] ,[CountryCode] FROM [test].[dbo].[Countries] Result:- Id CountryName CountryCode ------------------------------...

SQL IS NULL and NOT NULL Clause

“WHERE IS NULL, IS NOT NULL or NO WHERE clause depending on SQL Server parameter value”? 1.       Where IS NULL ? 2.       Where IS NOT NULL ? 3.       Where ANY VALUE ( NULL AND NOT NULL )? A “ NULL ” is a special value that signifies “ no value ” and comparing a column to NULL using the ( = ) operator is undefined. Instead use WHERE IS NULL or WHERE IS NOT NULL. Stayed Informed   -   37 Best SQL Server Interview Questions and Answers Syntax:-  -- WITH IS NULL SELECT ColumnName FROM TableName WHERE ColumnName IS NULL -- WITH IS NOT NULL SELECT ColumnName FROM TableName WHERE ColumnName IS NOT NULL Examples:- --SELECT ALL COUNTRIES SELECT * FROM Countries Result:- Id CountryName CountryCode ----------------------------------- 1 India IN 2 Nepal NP 3 USA US 4 Rasia NULL 5 Australia AUS Query With ...

SQL HAVING GROUP BY Clause

A “ HAVING ” Clause is use to filter a records using “ GROUP BY ” Clause and without GROUP BY clause, the HAVING work like a WHERE clause. Only the groups that meet the HAVING criteria will be returned. According to Wikipedia, A “ HAVING” clause in SQL specifies that an SQL SELECT   statement should only return rows where aggregate values meet the specified conditions. Stayed Informed   -   37 Best SQL Server Interview Questions and Answers Syntax:-  SELECT columnName FROM TableName WHERE condition GROUP BY columnName HAVING condition --WITH ORDER BY:- SELECT columnName FROM TableName WHERE condition GROUP BY columnName HAVING condition ORDER BY columnName Examples:- SELECT COUNT (Id) AS Counts, CountryName FROM Countries GROUP BY CountryName HAVING COUNT (Id) < 5 Result:- Counts CountryName -------------------- 1 Australia 1 India 1 Nepal 1 Rasia 1 USA Other Example, SELECT COUN...