Junior — Middle
Describe your practical experience using SQL in projects
sobes.tech AI
Answer from AI
In C# projects, I used SQL to interact with databases, mainly through ORM (e.g., Entity Framework) and directly via ADO.NET for complex queries.
Practical tasks included:
- Writing SELECT, INSERT, UPDATE, DELETE queries for data manipulation.
- Optimizing queries using indexes and proper JOINs.
- Creating stored procedures and triggers for business logic on the database side.
- Using parameterized queries to prevent SQL injection.
An example of a simple query via ADO.NET:
using(var connection = new SqlConnection(connectionString))
{
connection.Open();
var command = new SqlCommand("SELECT * FROM Users WHERE Id = @id", connection);
command.Parameters.AddWithValue("@id", userId);
var reader = command.ExecuteReader();
while(reader.Read())
{
// data processing
}
}
This experience allows for effective data handling and ensuring application performance.