SQL Server Operators List – SQL Server Tutorial

Sql Server Operators   :-

Arithmetic Operators:

  • +,-,*,/,%

Relational Operators:

  • >, <,>=, =, <> (or)! =

Logical Operators:

  • And, or, not

Special operators:

  • Between, in , like, is, any, all, exists, pivot [from 2008]

Set operators:

  • Union, union all, intersect, except.

Creating a table:–

       Syntax: Create table <tablename>

     (Column name data type[(size)]

      Colname data type [(size)],

       ———– )


(i)The table name should start with “alphabet”.

(ii) Spaces and special symbol aren’t allowed except(underscore_).

(iii)A table name can contain maximum of 128 character.

(iv)A table can contain maximum of 1024cols.

Example:   Create table emp

(empid     smallint

Ename       varchar(20),

Job            varchar(20),

Sal              small money,

Hiredate     smalldate time) 

Inserting A Data       :–

  • “Insert” command is used to insert data into a table.

Syntax:-insert into<table name>

                  Values (v1, v2, v3, ——–vn).

Note: — String & dates must be enclosed with single queries

          Eg: – insert into emp

                 Values (1, Anum, Hr, 5000, 07-oct-09)

Inserting null values:-

  • Null values can be inserted into two ways

(i)                 Explicitly—means——–by user

(ii)               implicitly————-by system

  • Inserting null value explicitly, we have to specify ”null”.

Example:-insert into emp values (2, B, NULL, NULL, 07-10-09)

  • Inserting null values implicitly   :

Syntax: insert into<tabname> (sal list) Values (value list)

Example:  insert into emp (empid, ename, hiredate) values (8,’c’,’08-oct-09’)

Leave a Reply

Your email address will not be published. Required fields are marked *