Friday, 16 February 2018

Sql query

create table table1
( Id int identity(100,-1),
  Name varchar(50),
  Address varchar(50)
)

insert into table1(Name,Address) values('A','Delhi'),('B','Chd'),('C','Noida'),('D','UP')


create table table2
( Id int identity(100,-1),
  Name1 varchar(50),
  Address1 varchar(50)
)

insert into table2(Name1,Address1) values('X','Delhi'),('Y','Chd'),('Z','Noida'),('U','UP')

what will be output-

select * from table1,table1  - It will throw error

select * from table1,table1 as tab - it will run and gives m*n records with all columns of both tables


select * from table1,table2 as tab - it will run and gives m*n records with all columns of both tables

No comments:

Post a Comment