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 / 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 |
Can I delete event logs?
How to attach adventureworkslt physical files to the server?
What is local temp table?
What is cursors?
What is single-user mode?
How you can find out if an index is useful to the optimizer?
what is the system function to get the current user's user id? : Sql server database administration
How will u find the query which is running in some other machine
4 Answers CarrizalSoft Technologies, IBM,
Does full backup break log chain?
What happens to a statement batch if there is a compilation error?
Why union all is faster than union?
what are the disadvantages of cursors? : Sql server database administration