sushmitha


{ City } bangalore
< Country > india
* Profession * software engineer
User No # 125112
Total Questions Posted # 0
Total Answers Posted # 2

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 0
Users Marked my Answers as Wrong # 0
Questions / { sushmitha }
Questions Answers Category Views Company eMail




Answers / { sushmitha }

Question { Verifone, 919 }

Is Sql non procedural query language?


Answer

SQL is called as a non Procedural language because the programmer or the user only specify what is needed and not tell the compiler how to do it, as done in Procedural language.

Is This Answer Correct ?    0 Yes 0 No

Question { Virtusa, 1850 }

How can you swap values between two rows in a table using single- SQL statement?


Answer

CREATE TABLE YourTable
(
ID INT,
PlateNo INT,
[Type] VARCHAR(20),
[Image Name] VARCHAR(20)
);

INSERT INTO YourTable
VALUES
(27,455,'User','img1.jpg'),
(32,542,'Alternative','img2.jpg');
SELECT * FROM YourTable

;WITH Cte AS
(SELECT T.*,T2.PlateNo PlateNo2, T2.Type Type2, T2.[Image Name] [Image Name 2] FROM YourTable T JOIN YourTable T2 ON T.ID<>T2.ID)
UPDATE Cte SET PlateNo = PlateNo2, Type=Type2,[Image Name]=[Image Name 2]


SELECT * FROM YourTable

DROP TABLE YourTable

Is This Answer Correct ?    0 Yes 0 No