Skip to main content

Posts

Showing posts with the label NOT EXISTS

Use of EXISTS and NOT EXISTS in SQL Server

SQL EXISTS condition are used for combination of sub queries and its sub query returns at least one row. SQL EXISTS condition can be used in a SELECT , INSERT , UPDATE or DELETE statement. Query Syntax E xists   :     WHERE   EXISTS ( --subquery ); Query Syntax Not Exists :     WHERE   NOT EXISTS ( --subquery ); The Live Query example code as given below -- CREATE TABLE MOBILE CREATE TABLE [dbo] . [Mobile] (             [UID] [varchar] ( 30 ) NOT NULL,             [Account] [varchar] ( 30 ) NOT NULL,             [Mobile] [char] ( 10 ) NOT NULL,             [AlertToMobile] [char] ( 10 ) NULL,             [AlertToEmail] [v...