What is the professional way of writing query in MS SQL server ?
what is the professional way of writing query in MS SQL server ?Need Sample example ?
CREATE PROCEDURE procname
(
--parameter1,
--parameter2....
)
AS
/*
Created By :
Created On :
Description :
Modified By :
Modified On :
*/
BEGIN
SELECT col1, col2, col3
FROM tablename
WHERE conditions
END
SELECT S.StudentId, S.StudentName, C. ClassName, SUM(A. Amount)
FROM Student S, Class C, Library L, Amount A
WHERE S.SyudetnId = C.StudentID
AND L.StudentId = S.StudentId
AND A. StudentId = S.StudentID
GROUP BY S.StudentId, S.StudentName, C. ClassName
HAVING COUNT (DISTINCT C.ClassId)>=2
Select (*/Column Name)
FROM TableName
WHERE
ORDER BY
Update TableName
SET Column1=Value,Column2=Value,.....
Where (Condition)
Delete FROM
Tablename WHERE (condition)