Archive

Posts Tagged ‘stored procedure’

SQL Interview Questions – Basics Book III

October 14th, 2010 admin No comments

What is the difference between a “where” clause and a “having” clause?

 ”Where” is a kind of restiriction statement. You use where clause to restrict all the data from DB.Where clause is used before result retrieving.

Ex:

Select * from EmployeeTable

Where EmpName = ‘Smith’

“Having” clause is used after Group by clause. It works the same way as the where clause on the results after applying group by.

Ex:

Select EmpName, Sum(salary)

        From SalaryTable

Where SalaryDate >’01/01/2010’

Group By EmpName

Having Sum(Salary) > ‘200000’

 

What is the basic form of a SQL statement to read data out of a table?

The basic form to read data out of table is “SELECT * FROM table_name;”

What is a “constraint”?

 A constraint allows you to apply simple integrity checks on a table. The primary types of constraints that are currently supported by SQL Server are :

PRIMARY/UNIQUE – enforces uniqueness of a particular table column.

FOREIGN KEY – validates that every value in a referenced column exists in a primary column of another table.

Read more…

Encrypt the stored procedures to hide details from users

October 11th, 2010 admin No comments

Encrypting a stored procedure will hide the definition of the procedure from users and it definition will not be displayed in the activity monitor.

The procedures can be encrypted by using “WITH ENCRYPTION” clause after the create statement.

ex: Read more…