Friday, January 1, 2021

Temporary Table

 Tempoary table is similar to parmanent table .It is create in TempDB  You can create or drop it .It is automatically drop when it is no longer used or closed connection .

Two type Temp Table  :

a. Local Temp 

b.Global Temp

IN SQL SERVER:

#CREATE TABLE  #EMP_DETAIL (ID INT ,NAME VARCHAR(10))        

Global Temp :It is visible of all the connection and destoryed when lost connection it will drop table.

#CREATE TABLE  ##EMP_DETAIL (ID INT ,NAME VARCHAR(10))        

IN MYSQL:

Exp :1

#CREATE TEMPORARY TABLE  tbl_TEMP (ID INT , NAME VARCHAR(10))

Exp: 2

#CREATE TEMPORARY TABLE  tbl_TEMP SELECT  * FROM  EMP_DETAILS 

#DROP TEMPORARY TABLE  tbl_TEMP ;


No comments:

Post a Comment

How to Find the Third highest salary in mysql

  set @b:=0; set @b1:=3;   # #select distinct salary,@b:=@b+1 as Row_no from emp select  * from emp where salary=( select salary from ( sele...