1.Describe way(s) to tune the SQL table in order to
optimize performance.

2. Explain SQL Injection and how can you prevent them?

Answer Posted / jerry joseph

1. identify and create optimal indexes for your tables

every table should have at least a clustered index

Indexes should be considered on all columns that are
frequently accessed by the WHERE, ORDER BY, GROUP BY, TOP,
and DISTINCT clauses

Static tables can be more heavily indexed that dynamic tables

2. An SQL Injection attack is a form of attack that comes
from user input that has not been checked to see that it is
valid. The objective is to fool the database system into
running malicious code that will reveal sensitive
information or otherwise compromise the server.

Example:
StrSQL = "SELECT * from Users WHERE username = '" +
txtUserName.Text + "' AND password = '" + txtPassword.Text +
"'";
if txtUserName is entered as "admin' OR 1 = 1;--" the query
becomes
"SELECT * from Users WHERE username = 'admin' OR 1 = 1;--'
AND password = '" + txtPassword.Text + "'"
user logs in as admin

Prevention :
Use Parameterized Queries or Stored Procedures to prevent
SQL Injection.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between update lock and exclusive lock?

690


Explain error and transaction handling in sql server?

707


Name 3 of the features that the sql server built-in function loginproperty performs on standard logins? : sql server security

878


Write a SQL query to delete a table?

866


Is the order of columns in the set clause important in ms sql server?

727


I have a table Events Events containing cardno,time,id,name--each id has a cardno my requirement is every day each employee swipe the card several times i want to calculate first and last time of each card the output should be name 1 2 6 7 in out in out holiday holiday xxx 09:30 06:30 09:40 06:45 where 1,2...... are dates for example january 1,2, etc. 6 and 7 are saturday and sunday how it is posssible

2017


What are number line correlation administrators will use while working with a subquery?

872


Explain index in sql server?

774


What is default port number for sql server 2000?

775


What is normalization and what are the advantages of it?

728


How to filter out duplications in the returning rows in ms sql server?

831


What is filtered index?

833


You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?

724


Why do we need normalization?

686


Define union, union all, minus, intersect?

759