You are here
Home > 2017


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

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%’

cross apply in sql

Cross Apply Cross apply operates on left and right inputs. It applies the right table expression to each row in left table. It only returns match rows. If right table expression returns empty row for left row and the left row is not return then operator behaves like a cross

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

SQL: Set Operators

SQL: Set Operators Set operators are used to combine same type of data from two or more tables. SQL supports following operators: a) Union b) Union all c) Intersect d) Except Rules on Set Operators: Column alias must be expressed in the first select statement. Each select statement must have the same number of