Database Flashcards
1
Q
Sql vs no sql
A
SQL databases are relational, offer strong consistency, and are suitable for structured data with fixed schemas.
NoSQL databases are non-relational, provide scalability and flexibility, and excel with unstructured data or when scalability is a priority.
2
Q
to write sargable queries
A
Search ARGument ABLE queries: (allow db engine use its ability to search)
1- avoid using functinos on indexed columns in where
2- use direct comparisons instead of wrapping into function
3- try to use computed column or function-based index instated of wrapping column into a function
non-sargable
~~~
WHERE YEAR(order_date) >= 2023
~~~
sargable
~~~
WHERE order_date >= ‘2023-01-01’
~~~