Checking the Employee table alredy exists or not.if exists
droping table.
IF OBJECT_ID('Employee','U') IS NOT NULL
DROP TABLE Employee
Ceating the Employee table
CREATE TABLE Employee
(
ID INT IDENTITY(1,1) PRIMARY KEY ,
NAME VARCHAR(20),
SALARY INT
)
Method -1:
Here inserting only one row into Employee table
INSERT INTO Employee (NAME,SALARY) VALUES('Rakesh',5000)
DELETE FROM Employee
Method -2:
Here inserting multiple rows into Employee table using union all statement.
INSERT INTO Employee
SELECT 'Rakesh',5000
UNION ALL
SELECT 'Ramu',6000
UNION ALL
SELECT 'Naresh',7000
DELETE FROM Employee
Method -3:
Here inserting multiple rows into Employee using values statement with comma separated (2008 sql server).
INSERT INTO Employee (NAME,SALARY)
VALUES ('Rakesh',5000)
,('Ramu',6000)
,('Naresh',7000)
DELETE FROM Employee
Comments
Post a Comment