You are here
Home > Sql Server

BETWEEN Operator in sql

BETWEEN Operator BETWEEN operator is used to select data that is within a range of values. It allows the selection of rows that contain values within a specified lower and upper limit. It can be used in where clause with a SELECT, DELETE, INSERT, or UPDATE statement. Syntax: SELECT column1, column2,….,

Character Functions in sql

Character Functions T-SQL supports many built-in functions. Concatenation T-SQL supports two ways to concatenate strings. one with the CONCAT function and another with the plus (+) operator. Example: select CONCAT('abc', 'xyz'); Output: abcxyz Example: select LEFT('abcxyz',2) + RIGHT('abcxyz',2); Output: abyz   Substring extraction and position                                T-SQL supports built-in functions like SUBSTRING, LEFT,

SQL Server Functions in sql

SQL Server Functions T-SQL supports many built-in functions. Scalar function returns a single value. Table-valued function returns a table result.  Conversion functions SQL supports number of functions that can convert a source expression to a target data type. SQL Server conversion functions are CAST and CONVERT. CAST: It converts an expression from one

ALTER COMMAND in sql

ALTER COMMAND It is used to modify the structure of the exiting table. Using ALTER command, it is possible to rename columns or the table itself, add or delete column, change the data type of exiting columns, add or drop the constraints in SQL server.   adding a column: ALTER TABLE allows

Handling NULLs in sql

Handling NULLs ISNULL() and COALESCE() functions are used to handle NULLs when combining data from different tables. ISNULL() and COALESCE() functions are commonly used functions that return first value that is not NULL among their inputs. ISNULL(): The ISNULL() function return first value that is not null among their input. It

Output option in sql

OUTPUT OPTION T-SQL supports an OUTPUT clause for modification statements, which we can use to return information from modified rows. We can use OUTPUT clause with update, insert, delete statements. UPDATE with OUTPUT: With the use of OUTPUT option in update statement we have access to both the old data and

Merge statement in sql

MERGE STATEMENT We can merge data from a source table into a target table using merge statement. The practical use of merge statement in data warehousing and in OLTP (Online Transaction Processing). Syntax: Merge into <target_tablename> as T Using <source_tablename> as S ON <merge_condition> When matched then <update or delete action> When not matched by

LIKE Operator in sql

LIKE Operator We can filter character string data based on pattern matching using LIKE operator. We can use LIKE operator in where clause of select, delete and update statement. Syntax: select column1, column2,….,columnN from table_name where column LIKE pattern; The wildcards used in LIKE patterns are:   Wildcard Meaning Example %(percent) Any string including an empty one ‘Kp%’

SQL Syntax

SQL Syntax SQL follows unique set of guidelines and rules called syntax. SQL is case insensitive. SQL statements start with any of the keywords/ commands like CREATE, DROP, INSERT, UPDATE, DELETE, SELECT, ALTER, USE etc. Here, we are gives you all the basic sql syntax. Create database: create database database_name; Create table: create

Top